[py-svn] commit/pytest: hpk42: fix python2.5 compatibility
Bitbucket
commits-noreply at bitbucket.org
Tue Jul 5 16:43:51 CEST 2011
1 new changeset in pytest:
http://bitbucket.org/hpk42/pytest/changeset/af84ecf20e0f/
changeset: af84ecf20e0f
user: hpk42
date: 2011-07-05 15:21:08
summary: fix python2.5 compatibility
affected #: 5 files (81 bytes)
--- a/CHANGELOG Sun Jul 03 19:28:48 2011 -0500
+++ b/CHANGELOG Tue Jul 05 15:21:08 2011 +0200
@@ -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.
--- a/_pytest/__init__.py Sun Jul 03 19:28:48 2011 -0500
+++ b/_pytest/__init__.py Tue Jul 05 15:21:08 2011 +0200
@@ -1,2 +1,2 @@
#
-__version__ = '2.1.0.dev4'
+__version__ = '2.1.0.dev5'
--- a/_pytest/assertion/__init__.py Sun Jul 03 19:28:48 2011 -0500
+++ b/_pytest/assertion/__init__.py Tue Jul 05 15:21:08 2011 +0200
@@ -7,8 +7,6 @@
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,8 +38,11 @@
mode = "off"
elif mode == "default":
mode = "rewrite"
- if mode == "on" and not REWRITING_AVAILABLE:
- mode = "reinterp"
+ if mode == "rewrite":
+ try:
+ import ast
+ except ImportError:
+ mode = "reinterp"
if mode != "off":
_load_modules(mode)
def callbinrepr(op, left, right):
--- a/setup.py Sun Jul 03 19:28:48 2011 -0500
+++ b/setup.py Tue Jul 05 15:21:08 2011 +0200
@@ -22,7 +22,7 @@
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'],
--- a/testing/test_assertion.py Sun Jul 03 19:28:48 2011 -0500
+++ b/testing/test_assertion.py Tue Jul 05 15:21:08 2011 +0200
@@ -120,6 +120,7 @@
expl = ' '.join(callequal('foo', 'bar'))
assert 'raised in repr()' not in expl
+ at needsnewassert
def test_rewritten(testdir):
testdir.makepyfile("""
def test_rewritten():
Repository URL: https://bitbucket.org/hpk42/pytest/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the pytest-commit
mailing list