fix python2.5 compatibility
This commit is contained in:
parent
a4fe63c08d
commit
407ca5b120
|
@ -1,6 +1,7 @@
|
|||
Changes between 2.0.3 and 2.1.0.DEV
|
||||
----------------------------------------------
|
||||
|
||||
- fix issue58 and issue59: new assertion code fixes
|
||||
- merge Benjamin's assertionrewrite branch: now assertions
|
||||
for test modules on python 2.6 and above are done by rewriting
|
||||
the AST and saving the pyc file before the test module is imported.
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
#
|
||||
__version__ = '2.1.0.dev4'
|
||||
__version__ = '2.1.0.dev5'
|
||||
|
|
|
@ -7,8 +7,6 @@ import pytest
|
|||
from _pytest.monkeypatch import monkeypatch
|
||||
from _pytest.assertion import util
|
||||
|
||||
REWRITING_AVAILABLE = "_ast" in sys.builtin_module_names
|
||||
|
||||
def pytest_addoption(parser):
|
||||
group = parser.getgroup("debugconfig")
|
||||
group.addoption('--assertmode', action="store", dest="assertmode",
|
||||
|
@ -40,7 +38,10 @@ def pytest_configure(config):
|
|||
mode = "off"
|
||||
elif mode == "default":
|
||||
mode = "rewrite"
|
||||
if mode == "on" and not REWRITING_AVAILABLE:
|
||||
if mode == "rewrite":
|
||||
try:
|
||||
import ast
|
||||
except ImportError:
|
||||
mode = "reinterp"
|
||||
if mode != "off":
|
||||
_load_modules(mode)
|
||||
|
|
2
setup.py
2
setup.py
|
@ -22,7 +22,7 @@ def main():
|
|||
name='pytest',
|
||||
description='py.test: simple powerful testing with Python',
|
||||
long_description = long_description,
|
||||
version='2.1.0.dev4',
|
||||
version='2.1.0.dev5',
|
||||
url='http://pytest.org',
|
||||
license='MIT license',
|
||||
platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'],
|
||||
|
|
|
@ -120,6 +120,7 @@ class TestAssert_reprcompare:
|
|||
expl = ' '.join(callequal('foo', 'bar'))
|
||||
assert 'raised in repr()' not in expl
|
||||
|
||||
@needsnewassert
|
||||
def test_rewritten(testdir):
|
||||
testdir.makepyfile("""
|
||||
def test_rewritten():
|
||||
|
|
Loading…
Reference in New Issue