cleanup test a bit

This commit is contained in:
Benjamin Peterson 2012-07-07 08:01:44 -07:00
parent 1aca6c9d7c
commit 099ac1e1f4
1 changed files with 4 additions and 6 deletions

View File

@ -10,7 +10,7 @@ if sys.platform.startswith("java"):
pytest.skip("assert rewrite does currently not work on jython") pytest.skip("assert rewrite does currently not work on jython")
from _pytest.assertion import util from _pytest.assertion import util
from _pytest.assertion.rewrite import rewrite_asserts from _pytest.assertion.rewrite import rewrite_asserts, PYTEST_TAG
def setup_module(mod): def setup_module(mod):
@ -353,7 +353,6 @@ def test_no_bytecode():
@pytest.mark.skipif('"__pypy__" in sys.modules') @pytest.mark.skipif('"__pypy__" in sys.modules')
def test_pyc_vs_pyo(self, testdir, monkeypatch): def test_pyc_vs_pyo(self, testdir, monkeypatch):
import _pytest.assertion.rewrite
testdir.makepyfile(""" testdir.makepyfile("""
import pytest import pytest
def test_optimized(): def test_optimized():
@ -364,12 +363,11 @@ def test_optimized():
tmp = "--basetemp=%s" % p tmp = "--basetemp=%s" % p
monkeypatch.setenv("PYTHONOPTIMIZE", "2") monkeypatch.setenv("PYTHONOPTIMIZE", "2")
assert testdir.runpybin("py.test", tmp).ret == 0 assert testdir.runpybin("py.test", tmp).ret == 0
fname = 'test_pyc_vs_pyo.%s.pyo' % _pytest.assertion.rewrite.PYTEST_TAG tagged = "test_pyc_vs_pyo." + PYTEST_TAG
assert fname in os.listdir('__pycache__') assert tagged + ".pyo" in os.listdir("__pycache__")
monkeypatch.undo() monkeypatch.undo()
assert testdir.runpybin("py.test", tmp).ret == 1 assert testdir.runpybin("py.test", tmp).ret == 1
fname = 'test_pyc_vs_pyo.%s.pyc' % _pytest.assertion.rewrite.PYTEST_TAG assert tagged + ".pyc" in os.listdir("__pycache__")
assert fname in os.listdir('__pycache__')
def test_package(self, testdir): def test_package(self, testdir):
pkg = testdir.tmpdir.join("pkg") pkg = testdir.tmpdir.join("pkg")