parent
4f735a66c5
commit
b7789714fd
|
@ -233,7 +233,7 @@ For your convenience here is also an inlined version of ``pytest_doctest.py``:
|
||||||
"*test_txtfile_failing.txt:2: DocTestFailure"
|
"*test_txtfile_failing.txt:2: DocTestFailure"
|
||||||
])
|
])
|
||||||
|
|
||||||
.. _`pytest_doctest.py`: http://bitbucket.org/hpk42/py-trunk/raw/e666e1d61190c52fb074f998d1781673db4d4d2f/py/test/plugin/pytest_doctest.py
|
.. _`pytest_doctest.py`: http://bitbucket.org/hpk42/py-trunk/raw/c28e76a64569475dda8b92c68f9c1c0902c5049e/py/test/plugin/pytest_doctest.py
|
||||||
.. _`extend`: ../extend.html
|
.. _`extend`: ../extend.html
|
||||||
.. _`plugins`: index.html
|
.. _`plugins`: index.html
|
||||||
.. _`contact`: ../../contact.html
|
.. _`contact`: ../../contact.html
|
||||||
|
|
|
@ -79,7 +79,7 @@ For your convenience here is also an inlined version of ``pytest_execnetcleanup.
|
||||||
""", "-s", "--debug")
|
""", "-s", "--debug")
|
||||||
reprec.assertoutcome(passed=2)
|
reprec.assertoutcome(passed=2)
|
||||||
|
|
||||||
.. _`pytest_execnetcleanup.py`: http://bitbucket.org/hpk42/py-trunk/raw/e666e1d61190c52fb074f998d1781673db4d4d2f/py/test/plugin/pytest_execnetcleanup.py
|
.. _`pytest_execnetcleanup.py`: http://bitbucket.org/hpk42/py-trunk/raw/c28e76a64569475dda8b92c68f9c1c0902c5049e/py/test/plugin/pytest_execnetcleanup.py
|
||||||
.. _`extend`: ../extend.html
|
.. _`extend`: ../extend.html
|
||||||
.. _`plugins`: index.html
|
.. _`plugins`: index.html
|
||||||
.. _`contact`: ../../contact.html
|
.. _`contact`: ../../contact.html
|
||||||
|
|
|
@ -103,7 +103,7 @@ For your convenience here is also an inlined version of ``pytest_figleaf.py``:
|
||||||
])
|
])
|
||||||
#print result.stdout.str()
|
#print result.stdout.str()
|
||||||
|
|
||||||
.. _`pytest_figleaf.py`: http://bitbucket.org/hpk42/py-trunk/raw/e666e1d61190c52fb074f998d1781673db4d4d2f/py/test/plugin/pytest_figleaf.py
|
.. _`pytest_figleaf.py`: http://bitbucket.org/hpk42/py-trunk/raw/c28e76a64569475dda8b92c68f9c1c0902c5049e/py/test/plugin/pytest_figleaf.py
|
||||||
.. _`extend`: ../extend.html
|
.. _`extend`: ../extend.html
|
||||||
.. _`plugins`: index.html
|
.. _`plugins`: index.html
|
||||||
.. _`contact`: ../../contact.html
|
.. _`contact`: ../../contact.html
|
||||||
|
|
|
@ -65,7 +65,7 @@ For your convenience here is also an inlined version of ``pytest_hooklog.py``:
|
||||||
assert s.find("ItemTestReport") != -1
|
assert s.find("ItemTestReport") != -1
|
||||||
assert s.find("sessionfinish") != -1
|
assert s.find("sessionfinish") != -1
|
||||||
|
|
||||||
.. _`pytest_hooklog.py`: http://bitbucket.org/hpk42/py-trunk/raw/e666e1d61190c52fb074f998d1781673db4d4d2f/py/test/plugin/pytest_hooklog.py
|
.. _`pytest_hooklog.py`: http://bitbucket.org/hpk42/py-trunk/raw/c28e76a64569475dda8b92c68f9c1c0902c5049e/py/test/plugin/pytest_hooklog.py
|
||||||
.. _`extend`: ../extend.html
|
.. _`extend`: ../extend.html
|
||||||
.. _`plugins`: index.html
|
.. _`plugins`: index.html
|
||||||
.. _`contact`: ../../contact.html
|
.. _`contact`: ../../contact.html
|
||||||
|
|
|
@ -164,7 +164,7 @@ For your convenience here is also an inlined version of ``pytest_iocapture.py``:
|
||||||
""")
|
""")
|
||||||
reprec.assertoutcome(passed=1)
|
reprec.assertoutcome(passed=1)
|
||||||
|
|
||||||
.. _`pytest_iocapture.py`: http://bitbucket.org/hpk42/py-trunk/raw/e666e1d61190c52fb074f998d1781673db4d4d2f/py/test/plugin/pytest_iocapture.py
|
.. _`pytest_iocapture.py`: http://bitbucket.org/hpk42/py-trunk/raw/c28e76a64569475dda8b92c68f9c1c0902c5049e/py/test/plugin/pytest_iocapture.py
|
||||||
.. _`extend`: ../extend.html
|
.. _`extend`: ../extend.html
|
||||||
.. _`plugins`: index.html
|
.. _`plugins`: index.html
|
||||||
.. _`contact`: ../../contact.html
|
.. _`contact`: ../../contact.html
|
||||||
|
|
|
@ -103,7 +103,7 @@ For your convenience here is also an inlined version of ``pytest_keyword.py``:
|
||||||
result = testdir.runpytest(p)
|
result = testdir.runpytest(p)
|
||||||
assert result.stdout.fnmatch_lines(["*passed*"])
|
assert result.stdout.fnmatch_lines(["*passed*"])
|
||||||
|
|
||||||
.. _`pytest_keyword.py`: http://bitbucket.org/hpk42/py-trunk/raw/e666e1d61190c52fb074f998d1781673db4d4d2f/py/test/plugin/pytest_keyword.py
|
.. _`pytest_keyword.py`: http://bitbucket.org/hpk42/py-trunk/raw/c28e76a64569475dda8b92c68f9c1c0902c5049e/py/test/plugin/pytest_keyword.py
|
||||||
.. _`extend`: ../extend.html
|
.. _`extend`: ../extend.html
|
||||||
.. _`plugins`: index.html
|
.. _`plugins`: index.html
|
||||||
.. _`contact`: ../../contact.html
|
.. _`contact`: ../../contact.html
|
||||||
|
|
|
@ -182,7 +182,7 @@ For your convenience here is also an inlined version of ``pytest_monkeypatch.py`
|
||||||
res = reprec.countoutcomes()
|
res = reprec.countoutcomes()
|
||||||
assert tuple(res) == (1, 0, 0), res
|
assert tuple(res) == (1, 0, 0), res
|
||||||
|
|
||||||
.. _`pytest_monkeypatch.py`: http://bitbucket.org/hpk42/py-trunk/raw/e666e1d61190c52fb074f998d1781673db4d4d2f/py/test/plugin/pytest_monkeypatch.py
|
.. _`pytest_monkeypatch.py`: http://bitbucket.org/hpk42/py-trunk/raw/c28e76a64569475dda8b92c68f9c1c0902c5049e/py/test/plugin/pytest_monkeypatch.py
|
||||||
.. _`extend`: ../extend.html
|
.. _`extend`: ../extend.html
|
||||||
.. _`plugins`: index.html
|
.. _`plugins`: index.html
|
||||||
.. _`contact`: ../../contact.html
|
.. _`contact`: ../../contact.html
|
||||||
|
|
|
@ -185,7 +185,7 @@ For your convenience here is also an inlined version of ``pytest_pdb.py``:
|
||||||
if child.isalive():
|
if child.isalive():
|
||||||
child.wait()
|
child.wait()
|
||||||
|
|
||||||
.. _`pytest_pdb.py`: http://bitbucket.org/hpk42/py-trunk/raw/e666e1d61190c52fb074f998d1781673db4d4d2f/py/test/plugin/pytest_pdb.py
|
.. _`pytest_pdb.py`: http://bitbucket.org/hpk42/py-trunk/raw/c28e76a64569475dda8b92c68f9c1c0902c5049e/py/test/plugin/pytest_pdb.py
|
||||||
.. _`extend`: ../extend.html
|
.. _`extend`: ../extend.html
|
||||||
.. _`plugins`: index.html
|
.. _`plugins`: index.html
|
||||||
.. _`contact`: ../../contact.html
|
.. _`contact`: ../../contact.html
|
||||||
|
|
|
@ -94,7 +94,7 @@ For your convenience here is also an inlined version of ``pytest_pocoo.py``:
|
||||||
assert s.find("def test_fail") != -1
|
assert s.find("def test_fail") != -1
|
||||||
assert reprec.countoutcomes() == [1,1,1]
|
assert reprec.countoutcomes() == [1,1,1]
|
||||||
|
|
||||||
.. _`pytest_pocoo.py`: http://bitbucket.org/hpk42/py-trunk/raw/e666e1d61190c52fb074f998d1781673db4d4d2f/py/test/plugin/pytest_pocoo.py
|
.. _`pytest_pocoo.py`: http://bitbucket.org/hpk42/py-trunk/raw/c28e76a64569475dda8b92c68f9c1c0902c5049e/py/test/plugin/pytest_pocoo.py
|
||||||
.. _`extend`: ../extend.html
|
.. _`extend`: ../extend.html
|
||||||
.. _`plugins`: index.html
|
.. _`plugins`: index.html
|
||||||
.. _`contact`: ../../contact.html
|
.. _`contact`: ../../contact.html
|
||||||
|
|
|
@ -561,7 +561,7 @@ For your convenience here is also an inlined version of ``pytest_pytester.py``:
|
||||||
"*1 passed*"
|
"*1 passed*"
|
||||||
])
|
])
|
||||||
|
|
||||||
.. _`pytest_pytester.py`: http://bitbucket.org/hpk42/py-trunk/raw/e666e1d61190c52fb074f998d1781673db4d4d2f/py/test/plugin/pytest_pytester.py
|
.. _`pytest_pytester.py`: http://bitbucket.org/hpk42/py-trunk/raw/c28e76a64569475dda8b92c68f9c1c0902c5049e/py/test/plugin/pytest_pytester.py
|
||||||
.. _`extend`: ../extend.html
|
.. _`extend`: ../extend.html
|
||||||
.. _`plugins`: index.html
|
.. _`plugins`: index.html
|
||||||
.. _`contact`: ../../contact.html
|
.. _`contact`: ../../contact.html
|
||||||
|
|
|
@ -204,7 +204,7 @@ For your convenience here is also an inlined version of ``pytest_recwarn.py``:
|
||||||
py.test.deprecated_call(dep_explicit, 0)
|
py.test.deprecated_call(dep_explicit, 0)
|
||||||
py.test.deprecated_call(dep_explicit, 0)
|
py.test.deprecated_call(dep_explicit, 0)
|
||||||
|
|
||||||
.. _`pytest_recwarn.py`: http://bitbucket.org/hpk42/py-trunk/raw/e666e1d61190c52fb074f998d1781673db4d4d2f/py/test/plugin/pytest_recwarn.py
|
.. _`pytest_recwarn.py`: http://bitbucket.org/hpk42/py-trunk/raw/c28e76a64569475dda8b92c68f9c1c0902c5049e/py/test/plugin/pytest_recwarn.py
|
||||||
.. _`extend`: ../extend.html
|
.. _`extend`: ../extend.html
|
||||||
.. _`plugins`: index.html
|
.. _`plugins`: index.html
|
||||||
.. _`contact`: ../../contact.html
|
.. _`contact`: ../../contact.html
|
||||||
|
|
|
@ -524,7 +524,7 @@ For your convenience here is also an inlined version of ``pytest_restdoc.py``:
|
||||||
assert not failed
|
assert not failed
|
||||||
assert skipped <= 1
|
assert skipped <= 1
|
||||||
|
|
||||||
.. _`pytest_restdoc.py`: http://bitbucket.org/hpk42/py-trunk/raw/e666e1d61190c52fb074f998d1781673db4d4d2f/py/test/plugin/pytest_restdoc.py
|
.. _`pytest_restdoc.py`: http://bitbucket.org/hpk42/py-trunk/raw/c28e76a64569475dda8b92c68f9c1c0902c5049e/py/test/plugin/pytest_restdoc.py
|
||||||
.. _`extend`: ../extend.html
|
.. _`extend`: ../extend.html
|
||||||
.. _`plugins`: index.html
|
.. _`plugins`: index.html
|
||||||
.. _`contact`: ../../contact.html
|
.. _`contact`: ../../contact.html
|
||||||
|
|
|
@ -274,7 +274,7 @@ For your convenience here is also an inlined version of ``pytest_resultlog.py``:
|
||||||
"s *:test_skip",
|
"s *:test_skip",
|
||||||
])
|
])
|
||||||
|
|
||||||
.. _`pytest_resultlog.py`: http://bitbucket.org/hpk42/py-trunk/raw/e666e1d61190c52fb074f998d1781673db4d4d2f/py/test/plugin/pytest_resultlog.py
|
.. _`pytest_resultlog.py`: http://bitbucket.org/hpk42/py-trunk/raw/c28e76a64569475dda8b92c68f9c1c0902c5049e/py/test/plugin/pytest_resultlog.py
|
||||||
.. _`extend`: ../extend.html
|
.. _`extend`: ../extend.html
|
||||||
.. _`plugins`: index.html
|
.. _`plugins`: index.html
|
||||||
.. _`contact`: ../../contact.html
|
.. _`contact`: ../../contact.html
|
||||||
|
|
|
@ -297,7 +297,7 @@ For your convenience here is also an inlined version of ``pytest_runner.py``:
|
||||||
col.setup()
|
col.setup()
|
||||||
self.stack.append(col)
|
self.stack.append(col)
|
||||||
|
|
||||||
.. _`pytest_runner.py`: http://bitbucket.org/hpk42/py-trunk/raw/e666e1d61190c52fb074f998d1781673db4d4d2f/py/test/plugin/pytest_runner.py
|
.. _`pytest_runner.py`: http://bitbucket.org/hpk42/py-trunk/raw/c28e76a64569475dda8b92c68f9c1c0902c5049e/py/test/plugin/pytest_runner.py
|
||||||
.. _`extend`: ../extend.html
|
.. _`extend`: ../extend.html
|
||||||
.. _`plugins`: index.html
|
.. _`plugins`: index.html
|
||||||
.. _`contact`: ../../contact.html
|
.. _`contact`: ../../contact.html
|
||||||
|
|
|
@ -425,7 +425,7 @@ For your convenience here is also an inlined version of ``pytest_terminal.py``:
|
||||||
except (TypeError, ValueError):
|
except (TypeError, ValueError):
|
||||||
return str(v)
|
return str(v)
|
||||||
|
|
||||||
.. _`pytest_terminal.py`: http://bitbucket.org/hpk42/py-trunk/raw/e666e1d61190c52fb074f998d1781673db4d4d2f/py/test/plugin/pytest_terminal.py
|
.. _`pytest_terminal.py`: http://bitbucket.org/hpk42/py-trunk/raw/c28e76a64569475dda8b92c68f9c1c0902c5049e/py/test/plugin/pytest_terminal.py
|
||||||
.. _`extend`: ../extend.html
|
.. _`extend`: ../extend.html
|
||||||
.. _`plugins`: index.html
|
.. _`plugins`: index.html
|
||||||
.. _`contact`: ../../contact.html
|
.. _`contact`: ../../contact.html
|
||||||
|
|
|
@ -4,14 +4,17 @@ pytest_unittest plugin
|
||||||
|
|
||||||
automatically discover and run traditional "unittest.py" style tests.
|
automatically discover and run traditional "unittest.py" style tests.
|
||||||
|
|
||||||
you can mix unittest TestCase subclasses and
|
Usage
|
||||||
py.test style tests in one test module.
|
----------------
|
||||||
|
|
||||||
XXX consider user-specified test_suite()
|
This plugin collects and runs Python `unittest.py style`_ tests.
|
||||||
|
It will automatically collect ``unittest.TestCase`` subclasses
|
||||||
|
and their ``test`` methods from the test modules of a project
|
||||||
|
(usually following the ``test_*.py`` pattern).
|
||||||
|
|
||||||
this code is somewhat derived from Guido Wesdorps
|
This plugin is enabled by default.
|
||||||
|
|
||||||
http://johnnydebris.net/svn/projects/py_unittest
|
.. _`unittest.py style`: http://docs.python.org/library/unittest.html
|
||||||
|
|
||||||
Getting and improving this plugin
|
Getting and improving this plugin
|
||||||
---------------------------------
|
---------------------------------
|
||||||
|
@ -34,19 +37,24 @@ For your convenience here is also an inlined version of ``pytest_unittest.py``:
|
||||||
"""
|
"""
|
||||||
automatically discover and run traditional "unittest.py" style tests.
|
automatically discover and run traditional "unittest.py" style tests.
|
||||||
|
|
||||||
you can mix unittest TestCase subclasses and
|
Usage
|
||||||
py.test style tests in one test module.
|
----------------
|
||||||
|
|
||||||
XXX consider user-specified test_suite()
|
This plugin collects and runs Python `unittest.py style`_ tests.
|
||||||
|
It will automatically collect ``unittest.TestCase`` subclasses
|
||||||
|
and their ``test`` methods from the test modules of a project
|
||||||
|
(usually following the ``test_*.py`` pattern).
|
||||||
|
|
||||||
this code is somewhat derived from Guido Wesdorps
|
This plugin is enabled by default.
|
||||||
|
|
||||||
http://johnnydebris.net/svn/projects/py_unittest
|
|
||||||
|
|
||||||
|
.. _`unittest.py style`: http://docs.python.org/library/unittest.html
|
||||||
"""
|
"""
|
||||||
import py
|
import py
|
||||||
|
import sys
|
||||||
|
|
||||||
def pytest_pycollect_makeitem(collector, name, obj):
|
def pytest_pycollect_makeitem(collector, name, obj):
|
||||||
|
if 'unittest' not in sys.modules:
|
||||||
|
return # nobody could have possibly derived a subclass
|
||||||
if py.std.inspect.isclass(obj) and issubclass(obj, py.std.unittest.TestCase):
|
if py.std.inspect.isclass(obj) and issubclass(obj, py.std.unittest.TestCase):
|
||||||
return UnitTestCase(name, parent=collector)
|
return UnitTestCase(name, parent=collector)
|
||||||
|
|
||||||
|
@ -147,7 +155,7 @@ For your convenience here is also an inlined version of ``pytest_unittest.py``:
|
||||||
assert passed == 2
|
assert passed == 2
|
||||||
assert passed + skipped + failed == 2
|
assert passed + skipped + failed == 2
|
||||||
|
|
||||||
.. _`pytest_unittest.py`: http://bitbucket.org/hpk42/py-trunk/raw/e666e1d61190c52fb074f998d1781673db4d4d2f/py/test/plugin/pytest_unittest.py
|
.. _`pytest_unittest.py`: http://bitbucket.org/hpk42/py-trunk/raw/c28e76a64569475dda8b92c68f9c1c0902c5049e/py/test/plugin/pytest_unittest.py
|
||||||
.. _`extend`: ../extend.html
|
.. _`extend`: ../extend.html
|
||||||
.. _`plugins`: index.html
|
.. _`plugins`: index.html
|
||||||
.. _`contact`: ../../contact.html
|
.. _`contact`: ../../contact.html
|
||||||
|
|
|
@ -127,7 +127,7 @@ For your convenience here is also an inlined version of ``pytest_xfail.py``:
|
||||||
])
|
])
|
||||||
assert result.ret == 1
|
assert result.ret == 1
|
||||||
|
|
||||||
.. _`pytest_xfail.py`: http://bitbucket.org/hpk42/py-trunk/raw/e666e1d61190c52fb074f998d1781673db4d4d2f/py/test/plugin/pytest_xfail.py
|
.. _`pytest_xfail.py`: http://bitbucket.org/hpk42/py-trunk/raw/c28e76a64569475dda8b92c68f9c1c0902c5049e/py/test/plugin/pytest_xfail.py
|
||||||
.. _`extend`: ../extend.html
|
.. _`extend`: ../extend.html
|
||||||
.. _`plugins`: index.html
|
.. _`plugins`: index.html
|
||||||
.. _`contact`: ../../contact.html
|
.. _`contact`: ../../contact.html
|
||||||
|
|
Loading…
Reference in New Issue