fix issue123 - new "python -m py.test" invocation.

--HG--
branch : trunk
This commit is contained in:
holger krekel 2010-10-05 17:52:32 +02:00
parent 7c6e47f715
commit eead8f9ab4
3 changed files with 15 additions and 0 deletions

View File

@ -2,6 +2,7 @@
Changes between 1.3.4 and 1.4.0.dev0 Changes between 1.3.4 and 1.4.0.dev0
================================================== ==================================================
- fix issue123 - new "python -m py.test" invocation for py.test
- 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.

6
py/test.py Normal file
View File

@ -0,0 +1,6 @@
if __name__ == '__main__':
import sys, py
sys.exit(py.test.cmdline.main())
# for more API entry points see the 'tests' definition
# in __init__.py

View File

@ -208,3 +208,11 @@ class TestGeneralUsage:
"*1 pass*", "*1 pass*",
]) ])
def test_python_minus_m_invocation(self, testdir):
p1 = testdir.makepyfile("def test_hello(): pass")
res = testdir.run(py.std.sys.executable, "-m", "py.test", str(p1))
assert res.ret == 0
p2 = testdir.makepyfile("def test_world(): 0/0")
res = testdir.run(py.std.sys.executable, "-m", "py.test", str(p2))
assert res.ret == 1