Skip to content

Commit

Permalink
Remove code related to support python <= 2.5
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoddemus committed Dec 16, 2015
1 parent fcc20d4 commit af893aa
Show file tree
Hide file tree
Showing 9 changed files with 1 addition and 49 deletions.
3 changes: 0 additions & 3 deletions _pytest/_argcomplete.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,6 @@ def __call__(self, prefix, **kwargs):
return completion

if os.environ.get('_ARGCOMPLETE'):
# argcomplete 0.5.6 is not compatible with python 2.5.6: print/with/format
if sys.version_info[:2] < (2, 6):
sys.exit(1)
try:
import argcomplete.completers
except ImportError:
Expand Down
3 changes: 0 additions & 3 deletions testing/acceptance_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,19 +450,16 @@ def test_hello():
"*1 passed*",
])

@pytest.mark.skipif("sys.version_info < (2,5)")
def test_python_minus_m_invocation_ok(self, testdir):
p1 = testdir.makepyfile("def test_hello(): pass")
res = testdir.run(py.std.sys.executable, "-m", "pytest", str(p1))
assert res.ret == 0

@pytest.mark.skipif("sys.version_info < (2,5)")
def test_python_minus_m_invocation_fail(self, testdir):
p1 = testdir.makepyfile("def test_fail(): 0/0")
res = testdir.run(py.std.sys.executable, "-m", "pytest", str(p1))
assert res.ret == 1

@pytest.mark.skipif("sys.version_info < (2,5)")
def test_python_pytest_package(self, testdir):
p1 = testdir.makepyfile("def test_pass(): pass")
res = testdir.run(py.std.sys.executable, "-m", "pytest", str(p1))
Expand Down
4 changes: 0 additions & 4 deletions testing/test_argcomplete.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,8 @@ def __call__(self, prefix, **kwargs):
completion += [f + '/' for f in anticomp]
return completion

# the following barfs with a syntax error on py2.5
# @pytest.mark.skipif("sys.version_info < (2,6)")
class TestArgComplete:
@pytest.mark.skipif("sys.platform in ('win32', 'darwin')")
@pytest.mark.skipif("sys.version_info < (2,6)")
def test_compare_with_compgen(self):
from _pytest._argcomplete import FastFilesCompleter
ffc = FastFilesCompleter()
Expand All @@ -82,7 +79,6 @@ def test_compare_with_compgen(self):
assert equal_with_bash(x, ffc, fc, out=py.std.sys.stdout)

@pytest.mark.skipif("sys.platform in ('win32', 'darwin')")
@pytest.mark.skipif("sys.version_info < (2,6)")
def test_remove_dir_prefix(self):
"""this is not compatible with compgen but it is with bash itself:
ls /usr/<TAB>
Expand Down
19 changes: 0 additions & 19 deletions testing/test_assertinterpret.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ def test_is():
assert s.startswith("assert 1 is 2")


@pytest.mark.skipif("sys.version_info < (2,6)")
def test_attrib():
class Foo(object):
b = 1
Expand All @@ -91,7 +90,6 @@ class Foo(object):
s = str(e)
assert s.startswith("assert 1 == 2")

@pytest.mark.skipif("sys.version_info < (2,6)")
def test_attrib_inst():
class Foo(object):
b = 1
Expand Down Expand Up @@ -256,7 +254,6 @@ def generate(self):
assert codelines == ["4 + 5", "getitem('', 'join')",
"setattr('x', 'y', 3)", "12 - 1"]

@pytest.mark.skipif("sys.version_info < (2,6)")
def test_assert_customizable_reprcompare(monkeypatch):
monkeypatch.setattr(util, '_reprcompare', lambda *args: 'hello')
try:
Expand Down Expand Up @@ -306,7 +303,6 @@ def test_hello():
])


@pytest.mark.skipif("sys.version_info < (2,5)")
def test_assert_raise_subclass():
class SomeEx(AssertionError):
def __init__(self, *args):
Expand Down Expand Up @@ -334,18 +330,3 @@ def myany(x):
e = exvalue()
s = str(e)
assert "<MY42 object> < 0" in s

@pytest.mark.skipif("sys.version_info >= (2,6)")
def test_oldinterpret_importation():
# we had a cyclic import there
# requires pytest on sys.path
res = py.std.subprocess.call([
py.std.sys.executable, '-c', str(py.code.Source("""
try:
from _pytest.assertion.newinterpret import interpret
except ImportError:
from _pytest.assertion.oldinterpret import interpret
"""))
])

assert res == 0
9 changes: 1 addition & 8 deletions testing/test_assertion.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from _pytest.assertion import reinterpret
from _pytest.assertion import util

needsnewassert = pytest.mark.skipif("sys.version_info < (2,6)")
PY3 = sys.version_info >= (3, 0)


Expand All @@ -26,7 +25,6 @@ def interpret(expr):
return reinterpret.reinterpret(expr, py.code.Frame(sys._getframe(1)))

class TestBinReprIntegration:
pytestmark = needsnewassert

def test_pytest_assertrepr_compare_called(self, testdir):
testdir.makeconftest("""
Expand Down Expand Up @@ -361,7 +359,6 @@ def test_rewritten():
*1 failed*
""")

@needsnewassert
def test_rewritten(testdir):
testdir.makepyfile("""
def test_rewritten():
Expand All @@ -374,7 +371,6 @@ def test_reprcompare_notin(mock_config):
mock_config, 'not in', 'foo', 'aaafoobbb')[1:]
assert detail == ["'foo' is contained here:", ' aaafoobbb', '? +++']

@needsnewassert
def test_pytest_assertrepr_compare_integration(testdir):
testdir.makepyfile("""
def test_hello():
Expand All @@ -391,7 +387,6 @@ def test_hello():
"*E*50*",
])

@needsnewassert
def test_sequence_comparison_uses_repr(testdir):
testdir.makepyfile("""
def test_hello():
Expand All @@ -410,7 +405,6 @@ def test_hello():
])


@pytest.mark.xfail("sys.version_info < (2,6)")
def test_assert_compare_truncate_longmessage(testdir):
testdir.makepyfile(r"""
def test_long():
Expand Down Expand Up @@ -438,7 +432,6 @@ def test_long():
])


@needsnewassert
def test_assertrepr_loaded_per_dir(testdir):
testdir.makepyfile(test_base=['def test_base(): assert 1 == 2'])
a = testdir.mkdir('a')
Expand Down Expand Up @@ -547,7 +540,7 @@ def test_onefails():
"*test_traceback_failure.py:4: AssertionError"
])

@pytest.mark.skipif("sys.version_info < (2,5) or '__pypy__' in sys.builtin_module_names or sys.platform.startswith('java')" )
@pytest.mark.skipif("'__pypy__' in sys.builtin_module_names or sys.platform.startswith('java')" )
def test_warn_missing(testdir):
testdir.makepyfile("")
result = testdir.run(sys.executable, "-OO", "-m", "pytest", "-h")
Expand Down
3 changes: 0 additions & 3 deletions testing/test_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ def pytest_configure(config):


class TestLastFailed:
@pytest.mark.skipif("sys.version_info < (2,6)")
def test_lastfailed_usecase(self, testdir, monkeypatch):
monkeypatch.setenv("PYTHONDONTWRITEBYTECODE", 1)
p = testdir.makepyfile("""
Expand Down Expand Up @@ -197,7 +196,6 @@ def test_always_fails():
"test_a.py*",
])

@pytest.mark.skipif("sys.version_info < (2,6)")
def test_lastfailed_difference_invocations(self, testdir, monkeypatch):
monkeypatch.setenv("PYTHONDONTWRITEBYTECODE", 1)
testdir.makepyfile(test_a="""
Expand Down Expand Up @@ -233,7 +231,6 @@ def test_b1():
"*1 failed*1 desel*",
])

@pytest.mark.skipif("sys.version_info < (2,6)")
def test_lastfailed_usecase_splice(self, testdir, monkeypatch):
monkeypatch.setenv("PYTHONDONTWRITEBYTECODE", 1)
testdir.makepyfile("""
Expand Down
2 changes: 0 additions & 2 deletions testing/test_mark.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,6 @@ def test_func(self):
assert 'hello' in keywords
assert 'world' in keywords

@pytest.mark.skipif("sys.version_info < (2,6)")
def test_mark_per_class_decorator(self, testdir):
item = testdir.getitem("""
import pytest
Expand All @@ -328,7 +327,6 @@ def test_func(self):
keywords = item.keywords
assert 'hello' in keywords

@pytest.mark.skipif("sys.version_info < (2,6)")
def test_mark_per_class_decorator_plus_existing_dec(self, testdir):
item = testdir.getitem("""
import pytest
Expand Down
1 change: 0 additions & 1 deletion testing/test_nose.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,6 @@ def test_fun(self):
result = testdir.runpytest()
result.assert_outcomes(passed=1)

@pytest.mark.skipif("sys.version_info < (2,6)")
def test_setup_teardown_linking_issue265(testdir):
# we accidentally didnt integrate nose setupstate with normal setupstate
# this test ensures that won't happen again
Expand Down
6 changes: 0 additions & 6 deletions testing/test_parseopt.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ def defaultget(option):
assert option.this == 42
assert option.no is False

@pytest.mark.skipif("sys.version_info < (2,5)")
def test_drop_short_helper(self):
parser = py.std.argparse.ArgumentParser(formatter_class=parseopt.DropShorterLongHelpFormatter)
parser.add_argument('-t', '--twoword', '--duo', '--two-word', '--two',
Expand Down Expand Up @@ -213,20 +212,17 @@ def test_drop_short_0(self, parser):
assert args.abc_def is False
assert args.klm_hij is True

@pytest.mark.skipif("sys.version_info < (2,5)")
def test_drop_short_2(self, parser):
parser.addoption('--func-arg', '--doit', action='store_true')
args = parser.parse(['--doit'])
assert args.func_arg is True

@pytest.mark.skipif("sys.version_info < (2,5)")
def test_drop_short_3(self, parser):
parser.addoption('--func-arg', '--funcarg', '--doit', action='store_true')
args = parser.parse(['abcd'])
assert args.func_arg is False
assert args.file_or_dir == ['abcd']

@pytest.mark.skipif("sys.version_info < (2,5)")
def test_drop_short_help0(self, parser, capsys):
parser.addoption('--func-args', '--doit', help = 'foo',
action='store_true')
Expand All @@ -235,7 +231,6 @@ def test_drop_short_help0(self, parser, capsys):
assert '--func-args, --doit foo' in help

# testing would be more helpful with all help generated
@pytest.mark.skipif("sys.version_info < (2,5)")
def test_drop_short_help1(self, parser, capsys):
group = parser.getgroup("general")
group.addoption('--doit', '--func-args', action='store_true', help='foo')
Expand All @@ -246,7 +241,6 @@ def test_drop_short_help1(self, parser, capsys):
assert '-doit, --func-args foo' in help


@pytest.mark.skipif("sys.version_info < (2,6)")
def test_argcomplete(testdir, monkeypatch):
if not py.path.local.sysfind('bash'):
pytest.skip("bash not available")
Expand Down

0 comments on commit af893aa

Please sign in to comment.