From af893aab263627ce98ae842851853bc77a85debb Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Wed, 16 Dec 2015 15:55:05 -0200 Subject: [PATCH] Remove code related to support python <= 2.5 Fix #1226 --- _pytest/_argcomplete.py | 3 --- testing/acceptance_test.py | 3 --- testing/test_argcomplete.py | 4 ---- testing/test_assertinterpret.py | 19 ------------------- testing/test_assertion.py | 9 +-------- testing/test_cache.py | 3 --- testing/test_mark.py | 2 -- testing/test_nose.py | 1 - testing/test_parseopt.py | 6 ------ 9 files changed, 1 insertion(+), 49 deletions(-) diff --git a/_pytest/_argcomplete.py b/_pytest/_argcomplete.py index 4f4eaf925fc..955855a9648 100644 --- a/_pytest/_argcomplete.py +++ b/_pytest/_argcomplete.py @@ -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: diff --git a/testing/acceptance_test.py b/testing/acceptance_test.py index b9a3fa38109..4cd731e7242 100644 --- a/testing/acceptance_test.py +++ b/testing/acceptance_test.py @@ -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)) diff --git a/testing/test_argcomplete.py b/testing/test_argcomplete.py index 9a218a401e9..ace7d8ceb43 100644 --- a/testing/test_argcomplete.py +++ b/testing/test_argcomplete.py @@ -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() @@ -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/ diff --git a/testing/test_assertinterpret.py b/testing/test_assertinterpret.py index 209bdfd495a..ad9bb5c7944 100644 --- a/testing/test_assertinterpret.py +++ b/testing/test_assertinterpret.py @@ -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 @@ -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 @@ -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: @@ -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): @@ -334,18 +330,3 @@ def myany(x): e = exvalue() s = str(e) assert " < 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 diff --git a/testing/test_assertion.py b/testing/test_assertion.py index 914feddf74a..cf715470ab2 100644 --- a/testing/test_assertion.py +++ b/testing/test_assertion.py @@ -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) @@ -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(""" @@ -361,7 +359,6 @@ def test_rewritten(): *1 failed* """) -@needsnewassert def test_rewritten(testdir): testdir.makepyfile(""" def test_rewritten(): @@ -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(): @@ -391,7 +387,6 @@ def test_hello(): "*E*50*", ]) -@needsnewassert def test_sequence_comparison_uses_repr(testdir): testdir.makepyfile(""" def test_hello(): @@ -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(): @@ -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') @@ -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") diff --git a/testing/test_cache.py b/testing/test_cache.py index 20a6cf78a1a..adac4a1a6d4 100755 --- a/testing/test_cache.py +++ b/testing/test_cache.py @@ -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(""" @@ -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=""" @@ -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(""" diff --git a/testing/test_mark.py b/testing/test_mark.py index 1aa33618308..1795928f02e 100644 --- a/testing/test_mark.py +++ b/testing/test_mark.py @@ -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 @@ -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 diff --git a/testing/test_nose.py b/testing/test_nose.py index 6260aae4788..a5162381e47 100644 --- a/testing/test_nose.py +++ b/testing/test_nose.py @@ -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 diff --git a/testing/test_parseopt.py b/testing/test_parseopt.py index 15b28225c5a..e45ee285409 100644 --- a/testing/test_parseopt.py +++ b/testing/test_parseopt.py @@ -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', @@ -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') @@ -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') @@ -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")