Switched to @pytest.mark.skipif.

This commit is contained in:
Jakub Roztocil 2014-04-24 15:17:23 +02:00
parent 941c0a8c3c
commit 6f28624134
5 changed files with 21 additions and 31 deletions

View File

@ -4,18 +4,6 @@ import time
import json
import shutil
import tempfile
try:
from unittest import skipIf, skip
except ImportError:
skip = lambda msg: lambda self: None
# noinspection PyUnusedLocal
def skipIf(cond, reason):
def decorator(test_method):
if cond:
return lambda self: None
return test_method
return decorator
from requests.structures import CaseInsensitiveDict

View File

@ -2,8 +2,9 @@
from unittest import TestCase
import requests
import pytest
from tests import http, httpbin, HTTP_OK, skipIf
from tests import http, httpbin, HTTP_OK
import httpie.input
@ -19,8 +20,9 @@ class AuthTest(TestCase):
assert '"authenticated": true' in r
assert '"user": "user"' in r
@skipIf(requests.__version__ == '0.13.6',
'Redirects with prefetch=False are broken in Requests 0.13.6')
@pytest.mark.skipif(
requests.__version__ == '0.13.6',
reason='Redirects with prefetch=False are broken in Requests 0.13.6')
def test_digest_auth(self):
r = http(
'--auth-type=digest',

View File

@ -2,7 +2,9 @@ import os
import subprocess
from unittest import TestCase
from tests import TESTS_ROOT, skipIf
import pytest
from tests import TESTS_ROOT
def has_docutils():
@ -28,7 +30,7 @@ def get_readme_errors():
class READMETest(TestCase):
@skipIf(not has_docutils(), 'docutils not installed')
@pytest.mark.skipif(not has_docutils(), reason='docutils not installed')
def test_README_reStructuredText_valid(self):
errors = get_readme_errors()
assert not errors, errors

View File

@ -1,12 +1,10 @@
from unittest import TestCase
import requests
import pytest
from httpie import ExitStatus
from tests import (
TestEnvironment,
http, httpbin, HTTP_OK, skip, skipIf
)
from tests import TestEnvironment, http, httpbin, HTTP_OK
class ExitStatusTest(TestCase):
@ -28,8 +26,8 @@ class ExitStatusTest(TestCase):
assert r.exit_status == ExitStatus.OK
assert not r.stderr
@skip('timeout broken in requests'
' (https://github.com/jkbr/httpie/issues/185)')
@pytest.mark.skipif(True, reason='timeout broken in requests'
' (https://github.com/jkbr/httpie/issues/185)')
def test_timeout_exit_status(self):
r = http(
'--timeout=0.5',
@ -50,8 +48,9 @@ class ExitStatusTest(TestCase):
assert r.exit_status == ExitStatus.ERROR_HTTP_3XX
assert '301 moved permanently' in r.stderr.lower()
@skipIf(requests.__version__ == '0.13.6',
'Redirects with prefetch=False are broken in Requests 0.13.6')
@pytest.mark.skipif(
requests.__version__ == '0.13.6',
reason='Redirects with prefetch=False are broken in Requests 0.13.6')
def test_3xx_check_status_redirects_allowed_exits_0(self):
r = http(
'--check-status',

View File

@ -2,16 +2,15 @@ import os
import tempfile
from unittest import TestCase
from tests import (
TestEnvironment,
http, httpbin, Environment, skip
)
import pytest
from tests import TestEnvironment, http, httpbin, Environment
from httpie.compat import is_windows
class WindowsOnlyTests(TestCase):
@skip('FIXME: kills the runner')
#@skipIf(not is_windows, 'windows-only')
@pytest.mark.skipif(not is_windows, reason='windows-only')
def test_windows_colorized_output(self):
# Spits out the colorized output.
http(httpbin('/get'), env=Environment())