holger krekel avatar holger krekel committed f8223ed

fix issue206 - unset PYTHONDONTWRITEBYTECODE in assertrewrite test

Comments (0)

Files changed (5)

 
 - fix exception message check of test_nose.py to pass on python33 as well
 
+- fix issue206 - fix test_assertrewrite.py to work when a global
+  PYTHONDONTWRITEBYTECODE=1 is present
+
 - add tox.ini to pytest distribution so that ignore-dirs and others config
   bits are properly distributed for maintainers who run pytest-own tests
 

_pytest/__init__.py

 #
-__version__ = '2.3.2.dev4'
+__version__ = '2.3.2.dev5'
         name='pytest',
         description='py.test: simple powerful testing with Python',
         long_description = long_description,
-        version='2.3.2.dev4',
+        version='2.3.2.dev5',
         url='http://pytest.org',
         license='MIT license',
         platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'],

testing/test_assertrewrite.py

     @pytest.mark.skipif('"__pypy__" in sys.modules')
     def test_pyc_vs_pyo(self, testdir, monkeypatch):
         testdir.makepyfile("""
-import pytest
-def test_optimized():
-    "hello"
-    assert test_optimized.__doc__ is None""")
+            import pytest
+            def test_optimized():
+                "hello"
+                assert test_optimized.__doc__ is None"""
+        )
         p = py.path.local.make_numbered_dir(prefix="runpytest-", keep=None,
                                             rootdir=testdir.tmpdir)
         tmp = "--basetemp=%s" % p
         monkeypatch.setenv("PYTHONOPTIMIZE", "2")
+        monkeypatch.delenv("PYTHONDONTWRITEBYTECODE", raising=False)
         assert testdir.runpybin("py.test", tmp).ret == 0
         tagged = "test_pyc_vs_pyo." + PYTEST_TAG
         assert tagged + ".pyo" in os.listdir("__pycache__")
         monkeypatch.undo()
+        monkeypatch.delenv("PYTHONDONTWRITEBYTECODE", raising=False)
         assert testdir.runpybin("py.test", tmp).ret == 1
         assert tagged + ".pyc" in os.listdir("__pycache__")
 
 [tox]
 distshare={homedir}/.tox/distshare
-envlist=py26,py27,py31,py32,py33,py27-xdist,py25,trial
+envlist=py26,py27,py27-nobyte,py31,py32,py33,py27-xdist,py25,trial
 indexserver=
     pypi = http://pypi.python.org/simple
     testrun = http://pypi.testrun.org
 deps=pytest-xdist
 commands=
   py.test -n3 -rfsxX \
-        --ignore .tox --junitxml={envlogdir}/junit-{envname}.xml testing
+        --junitxml={envlogdir}/junit-{envname}.xml testing
+
+[testenv:py27-nobyte]
+changedir=.
+basepython=python2.7
+deps=pytest-xdist
+setenv=
+    PYTHONDONTWRITEBYTECODE=1
+commands=
+  py.test -n3 -rfsxX \
+        --junitxml={envlogdir}/junit-{envname}.xml []
 
 [testenv:trial]
 changedir=.
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.