Skip to content

Commit

Permalink
Merge pull request #165 from hugovk/rm-2.6-3.3
Browse files Browse the repository at this point in the history
Drop support for EOL Python <= 2.6, 3.0-3.3
  • Loading branch information
nicoddemus committed Nov 13, 2017
2 parents aa56ef0 + 70e8994 commit e188b67
Show file tree
Hide file tree
Showing 17 changed files with 13 additions and 79 deletions.
2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
sudo: false
language: python
python:
- '2.6'
- '2.7'
- '3.3'
- '3.4'
- '3.5'
- '3.6'
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
1.5.0
=====

- python 2.6 and 3.3 are no longer supported
- deprecate py.std and remove all internal uses
- fix #73 turn py.error into an actual module
- path join to / no longer produces leading double slashes
Expand Down
6 changes: 0 additions & 6 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
environment:
matrix:
# note: please use "tox --listenvs" to populate the build matrix below
- TOXENV: "py26-pytest29"
- TOXENV: "py26-pytest30"
- TOXENV: "py26-pytest31"
- TOXENV: "py27-pytest29"
- TOXENV: "py27-pytest30"
- TOXENV: "py27-pytest31"
- TOXENV: "py33-pytest29"
- TOXENV: "py33-pytest30"
- TOXENV: "py33-pytest31"
- TOXENV: "py34-pytest29"
- TOXENV: "py34-pytest30"
- TOXENV: "py34-pytest31"
Expand Down
7 changes: 1 addition & 6 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@ def sshhost(request):
# XXX copied from execnet's conftest.py - needs to be merged
winpymap = {
'python2.7': r'C:\Python27\python.exe',
'python2.6': r'C:\Python26\python.exe',
'python2.5': r'C:\Python25\python.exe',
'python2.4': r'C:\Python24\python.exe',
'python3.1': r'C:\Python31\python.exe',
}


Expand All @@ -49,8 +45,7 @@ def getexecutable(name, cache={}):
return executable


@pytest.fixture(params=('python2.4', 'python2.5', 'python2.6',
'python2.7', 'python3.1', 'pypy-c', 'jython'))
@pytest.fixture(params=('python2.7', 'pypy-c', 'jython'))
def anypython(request):
name = request.param
executable = getexecutable(name)
Expand Down
2 changes: 1 addition & 1 deletion doc/install.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ installation info in a nutshell

**PyPI name**: py_

**Pythons**: CPython 2.6, 2.7, 3.3, 3.4, PyPy-2.3
**Pythons**: CPython 2.7, 3.4, 3.5, 3.6, PyPy-5.4

**Operating systems**: Linux, Windows, OSX, Unix

Expand Down
25 changes: 4 additions & 21 deletions py/_code/_assertionnew.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,10 @@
from py._code.assertion import _format_explanation, BuiltinAssertionError


if sys.platform.startswith("java") and sys.version_info < (2, 5, 2):
# See http://bugs.jython.org/issue1497
_exprs = ("BoolOp", "BinOp", "UnaryOp", "Lambda", "IfExp", "Dict",
"ListComp", "GeneratorExp", "Yield", "Compare", "Call",
"Repr", "Num", "Str", "Attribute", "Subscript", "Name",
"List", "Tuple")
_stmts = ("FunctionDef", "ClassDef", "Return", "Delete", "Assign",
"AugAssign", "Print", "For", "While", "If", "With", "Raise",
"TryExcept", "TryFinally", "Assert", "Import", "ImportFrom",
"Exec", "Global", "Expr", "Pass", "Break", "Continue")
_expr_nodes = set(getattr(ast, name) for name in _exprs)
_stmt_nodes = set(getattr(ast, name) for name in _stmts)
def _is_ast_expr(node):
return node.__class__ in _expr_nodes
def _is_ast_stmt(node):
return node.__class__ in _stmt_nodes
else:
def _is_ast_expr(node):
return isinstance(node, ast.expr)
def _is_ast_stmt(node):
return isinstance(node, ast.stmt)
def _is_ast_expr(node):
return isinstance(node, ast.expr)
def _is_ast_stmt(node):
return isinstance(node, ast.stmt)


class Failure(Exception):
Expand Down
6 changes: 1 addition & 5 deletions py/_code/assertion.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,4 @@ def __init__(self, *args):
reinterpret_old = "old reinterpretation not available for py3"
else:
from py._code._assertionold import interpret as reinterpret_old
if sys.version_info >= (2, 6) or (sys.platform.startswith("java")):
from py._code._assertionnew import interpret as reinterpret
else:
reinterpret = reinterpret_old

from py._code._assertionnew import interpret as reinterpret
2 changes: 0 additions & 2 deletions py/_code/source.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,8 +335,6 @@ def get_statement_startend2(lineno, node):
def getstatementrange_ast(lineno, source, assertion=False, astnode=None):
if astnode is None:
content = str(source)
if sys.version_info < (2,7):
content += "\n"
try:
astnode = compile(content, "source", "exec", 1024) # 1024 for AST
except ValueError:
Expand Down
3 changes: 0 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,11 @@ def main():
'Topic :: Utilities',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
],
Expand Down
4 changes: 0 additions & 4 deletions testing/code/test_assertion.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ def test_is():
assert s.startswith("assert 1 is 2")


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

@py.test.mark.skipif("sys.version_info < (2,6)")
def test_attrib_inst():
class Foo(object):
b = 1
Expand Down Expand Up @@ -227,7 +225,6 @@ def test_underscore_api():
py.code._reinterpret_old # used by pypy
py.code._reinterpret

@py.test.mark.skipif("sys.version_info < (2,6)")
def test_assert_customizable_reprcompare(monkeypatch):
util = pytest.importorskip("_pytest.assertion.util")
monkeypatch.setattr(util, '_reprcompare', lambda *args: 'hello')
Expand Down Expand Up @@ -279,7 +276,6 @@ def test_hello():
@py.test.mark.xfail(py.test.__version__[0] != "2",
reason="broken on modern pytest",
run=False)
@py.test.mark.skipif("sys.version_info < (2,5)")
def test_assert_raise_subclass():
class SomeEx(AssertionError):
def __init__(self, *args):
Expand Down
9 changes: 2 additions & 7 deletions testing/code/test_excinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,10 +305,7 @@ def test_excinfo_no_sourcecode():
except ValueError:
excinfo = py.code.ExceptionInfo()
s = str(excinfo.traceback[-1])
if sys.version_info < (2, 5):
assert s == " File '<string>':1 in ?\n ???\n"
else:
assert s == " File '<string>':1 in <module>\n ???\n"
assert s == " File '<string>':1 in <module>\n ???\n"


def test_excinfo_no_python_sourcecode(tmpdir):
Expand Down Expand Up @@ -918,9 +915,7 @@ def test_native_style(self):
assert s.startswith('Traceback (most recent call last):\n File')
assert s.endswith('\nAssertionError: assert 0')
assert 'exec (source.compile())' in s
# python 2.4 fails to get the source line for the assert
if sys.version_info >= (2, 5):
assert s.count('assert 0') == 2
assert s.count('assert 0') == 2

@broken_on_modern_pytest
def test_traceback_repr_style(self, importasmod):
Expand Down
4 changes: 0 additions & 4 deletions testing/code/test_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,6 @@ def test_some():
assert getstatement(2, source).lines == source.lines[2:3]
assert getstatement(3, source).lines == source.lines[3:4]

@py.test.mark.skipif("sys.version_info < (2,6)")
def test_getstatementrange_out_of_bounds_py3(self):
source = Source("if xxx:\n from .collections import something")
r = source.getstatementrange(1)
Expand All @@ -262,7 +261,6 @@ def test_getstatementrange_with_syntaxerror_issue7(self):
source = Source(":")
py.test.raises(SyntaxError, lambda: source.getstatementrange(0))

@py.test.mark.skipif("sys.version_info < (2,6)")
def test_compile_to_ast(self):
import ast
source = Source("x = 4")
Expand Down Expand Up @@ -380,8 +378,6 @@ def g():
lines = deindent(source.splitlines())
assert lines == ['', 'def f():', ' def g():', ' pass', ' ']

@py.test.mark.xfail("sys.version_info[:3] < (2,7,0) or "
"((3,0) <= sys.version_info[:2] < (3,2))")
def test_source_of_class_at_eof_without_newline(tmpdir):
# this test fails because the implicit inspect.getsource(A) below
# does not return the "x = 1" last line.
Expand Down
5 changes: 1 addition & 4 deletions testing/io_/test_saferepr.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,7 @@ class BrokenReprException(Exception):
assert 'Exception' in saferepr(BrokenRepr(Exception("broken")))
s = saferepr(BrokenReprException("really broken"))
assert 'TypeError' in s
if sys.version_info < (2,6):
assert 'unknown' in saferepr(BrokenRepr("string"))
else:
assert 'TypeError' in saferepr(BrokenRepr("string"))
assert 'TypeError' in saferepr(BrokenRepr("string"))

s2 = saferepr(BrokenRepr(BrokenReprException('omg even worse')))
assert 'NameError' not in s2
Expand Down
5 changes: 1 addition & 4 deletions testing/path/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,10 +477,7 @@ def setuptestfs(path):
otherdir.ensure('__init__.py')

module_a = otherdir.ensure('a.py')
if sys.version_info >= (2,6):
module_a.write('from .b import stuff as result\n')
else:
module_a.write('from b import stuff as result\n')
module_a.write('from .b import stuff as result\n')
module_b = otherdir.ensure('b.py')
module_b.write('stuff="got it"\n')
module_c = otherdir.ensure('c.py')
Expand Down
5 changes: 0 additions & 5 deletions testing/path/test_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ def test_initialize_reldir(self, path1):
p = local('samplefile')
assert p.check()

@pytest.mark.xfail("sys.version_info < (2,6) and sys.platform == 'win32'")
def test_tilde_expansion(self, monkeypatch, tmpdir):
monkeypatch.setenv("HOME", str(tmpdir))
p = py.path.local("~", expanduser=True)
Expand Down Expand Up @@ -354,10 +353,6 @@ def test_fspath_protocol_other_class(self, fake_fspath_obj):
assert py_path.join(fake_fspath_obj).strpath == os.path.join(
py_path.strpath, str_path)

@pytest.mark.skipif(sys.version_info[:2] == (2, 6) and sys.platform.startswith('win'),
reason='multiprocessing bug in Python 2.6/Windows prevents this test '
'from working as intended '
'(see https://bugs.python.org/issue10845 and #157).')
def test_make_numbered_dir_multiprocess_safe(self, tmpdir):
# https://github.com/pytest-dev/py/issues/30
pool = multiprocessing.Pool()
Expand Down
4 changes: 0 additions & 4 deletions testing/process/test_forkedfunc.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,6 @@ def boxf3():
def test_forkedfunc_signal():
result = py.process.ForkedFunc(boxseg).waitfinish()
assert result.retval is None
if sys.version_info < (2,4):
py.test.skip("signal detection does not work with python prior 2.4")
assert result.signal == 11

def test_forkedfunc_huge_data():
Expand Down Expand Up @@ -116,8 +114,6 @@ def box_fun():
ff = py.process.ForkedFunc(box_fun)
os.kill(ff.pid, 15)
result = ff.waitfinish()
if sys.version_info < (2,4):
py.test.skip("signal detection does not work with python prior 2.4")
assert result.signal == 15


Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist=py{26,27,33,34,35,36}-pytest{29,30,31}
envlist=py{27,34,35,36}-pytest{29,30,31}

[testenv]
changedir=testing
Expand Down

0 comments on commit e188b67

Please sign in to comment.