Remove code related to support python <= 2.5

Fix #1226
This commit is contained in:
Bruno Oliveira 2015-12-16 15:55:05 -02:00
parent fcc20d4181
commit af893aab26
9 changed files with 1 additions and 49 deletions

View File

@ -88,9 +88,6 @@ class FastFilesCompleter:
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:

View File

@ -450,19 +450,16 @@ class TestInvocationVariants:
"*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))

View File

@ -69,11 +69,8 @@ class FilesCompleter(object):
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 @@ class TestArgComplete:
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>

View File

@ -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 @@ def test_attrib():
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 @@ class TestView:
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_assert_raise_alias(testdir):
])
@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 test_assert_raises_in_nonzero_of_object_pytest_issue10():
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

View File

@ -7,7 +7,6 @@ import _pytest.assertion as plugin
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_python25_compile_issue257(testdir):
*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_pytest_assertrepr_compare_integration(testdir):
"*E*50*",
])
@needsnewassert
def test_sequence_comparison_uses_repr(testdir):
testdir.makepyfile("""
def test_hello():
@ -410,7 +405,6 @@ def test_sequence_comparison_uses_repr(testdir):
])
@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_assert_compare_truncate_longmessage(testdir):
])
@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_traceback_failure(testdir):
"*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")

View File

@ -129,7 +129,6 @@ def test_cache_show(testdir):
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 @@ class TestLastFailed:
"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 @@ class TestLastFailed:
"*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("""

View File

@ -316,7 +316,6 @@ class TestFunctional:
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 @@ class TestFunctional:
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

View File

@ -300,7 +300,6 @@ def test_apiwrapper_problem_issue260(testdir):
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

View File

@ -171,7 +171,6 @@ class TestParser:
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 @@ class TestParser:
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 @@ class TestParser:
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 @@ class TestParser:
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")