fix issue206 - unset PYTHONDONTWRITEBYTECODE in assertrewrite test

This commit is contained in:
holger krekel 2012-10-22 11:14:18 +02:00
parent 1b61fbc8ed
commit 036557ac18
5 changed files with 24 additions and 8 deletions

View File

@ -6,6 +6,9 @@ Changes between 2.3.1 and 2.3.2.dev
- 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

View File

@ -1,2 +1,2 @@
#
__version__ = '2.3.2.dev4'
__version__ = '2.3.2.dev5'

View File

@ -24,7 +24,7 @@ def main():
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'],

View File

@ -354,18 +354,21 @@ def test_no_bytecode():
@pytest.mark.skipif('"__pypy__" in sys.modules')
def test_pyc_vs_pyo(self, testdir, monkeypatch):
testdir.makepyfile("""
import pytest
def test_optimized():
import pytest
def test_optimized():
"hello"
assert test_optimized.__doc__ is None""")
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__")

14
tox.ini
View File

@ -1,6 +1,6 @@
[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
@ -24,7 +24,17 @@ basepython=python2.7
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=.