From eead8f9ab4638076702a5c62fb70b32e078f595b Mon Sep 17 00:00:00 2001 From: holger krekel Date: Tue, 5 Oct 2010 17:52:32 +0200 Subject: [PATCH] fix issue123 - new "python -m py.test" invocation. --HG-- branch : trunk --- CHANGELOG | 1 + py/test.py | 6 ++++++ testing/acceptance_test.py | 8 ++++++++ 3 files changed, 15 insertions(+) create mode 100644 py/test.py diff --git a/CHANGELOG b/CHANGELOG index 38124fc31..8450fa267 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -2,6 +2,7 @@ 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 files on filedescriptor 1 (stdout). - fix issue109 - sibling conftest.py files will not be loaded. diff --git a/py/test.py b/py/test.py new file mode 100644 index 000000000..a5a0de5a2 --- /dev/null +++ b/py/test.py @@ -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 diff --git a/testing/acceptance_test.py b/testing/acceptance_test.py index 617006eda..720f29cc6 100644 --- a/testing/acceptance_test.py +++ b/testing/acceptance_test.py @@ -208,3 +208,11 @@ class TestGeneralUsage: "*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