fix tests to avoid pyc-caching and skip python2.4 which doesn't support "python -m" on packages.

--HG--
branch : trunk
This commit is contained in:
holger krekel 2010-10-06 09:40:14 +02:00
parent 89c53de084
commit fe54762b93
2 changed files with 8 additions and 3 deletions

View File

@ -3,6 +3,7 @@ Changes between 1.3.4 and 1.4.0.dev0
================================================== ==================================================
- fix issue123 - new "python -m py.test" invocation for py.test - fix issue123 - new "python -m py.test" invocation for py.test
(requires Python 2.5 or above)
- fix issue124 - make reporting more resilient against tests opening - fix issue124 - make reporting more resilient against tests opening
files on filedescriptor 1 (stdout). files on filedescriptor 1 (stdout).
- fix issue109 - sibling conftest.py files will not be loaded. - fix issue109 - sibling conftest.py files will not be loaded.

View File

@ -209,10 +209,14 @@ class TestGeneralUsage:
]) ])
def test_python_minus_m_invocation(self, testdir): @py.test.mark.skipif("sys.version_info < (2,5)")
def test_python_minus_m_invocation_ok(self, testdir):
p1 = testdir.makepyfile("def test_hello(): pass") p1 = testdir.makepyfile("def test_hello(): pass")
res = testdir.run(py.std.sys.executable, "-m", "py.test", str(p1)) res = testdir.run(py.std.sys.executable, "-m", "py.test", str(p1))
assert res.ret == 0 assert res.ret == 0
p2 = testdir.makepyfile("def test_world(): 0/0")
res = testdir.run(py.std.sys.executable, "-m", "py.test", str(p2)) @py.test.mark.skipif("sys.version_info < (2,5)")
def test_python_minus_m_invocation_fail(self, testdir):
p1 = testdir.makepyfile("def test_fail(): 0/0")
res = testdir.run(py.std.sys.executable, "-m", "py.test", str(p1))
assert res.ret == 1 assert res.ret == 1