diff --git a/doc/test/plugin/doctest.txt b/doc/test/plugin/doctest.txt index 7948f80e4..445a6dbda 100644 --- a/doc/test/plugin/doctest.txt +++ b/doc/test/plugin/doctest.txt @@ -233,7 +233,7 @@ For your convenience here is also an inlined version of ``pytest_doctest.py``: "*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 .. _`plugins`: index.html .. _`contact`: ../../contact.html diff --git a/doc/test/plugin/execnetcleanup.txt b/doc/test/plugin/execnetcleanup.txt index 9327d3a44..e99d093c5 100644 --- a/doc/test/plugin/execnetcleanup.txt +++ b/doc/test/plugin/execnetcleanup.txt @@ -79,7 +79,7 @@ For your convenience here is also an inlined version of ``pytest_execnetcleanup. """, "-s", "--debug") 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 .. _`plugins`: index.html .. _`contact`: ../../contact.html diff --git a/doc/test/plugin/figleaf.txt b/doc/test/plugin/figleaf.txt index 0320a5eac..ad4678108 100644 --- a/doc/test/plugin/figleaf.txt +++ b/doc/test/plugin/figleaf.txt @@ -103,7 +103,7 @@ For your convenience here is also an inlined version of ``pytest_figleaf.py``: ]) #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 .. _`plugins`: index.html .. _`contact`: ../../contact.html diff --git a/doc/test/plugin/hooklog.txt b/doc/test/plugin/hooklog.txt index f8dece7ee..868c1ab89 100644 --- a/doc/test/plugin/hooklog.txt +++ b/doc/test/plugin/hooklog.txt @@ -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("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 .. _`plugins`: index.html .. _`contact`: ../../contact.html diff --git a/doc/test/plugin/iocapture.txt b/doc/test/plugin/iocapture.txt index ecc572fe6..bcf99dced 100644 --- a/doc/test/plugin/iocapture.txt +++ b/doc/test/plugin/iocapture.txt @@ -164,7 +164,7 @@ For your convenience here is also an inlined version of ``pytest_iocapture.py``: """) 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 .. _`plugins`: index.html .. _`contact`: ../../contact.html diff --git a/doc/test/plugin/keyword.txt b/doc/test/plugin/keyword.txt index 57f9e4ec2..c159c9b15 100644 --- a/doc/test/plugin/keyword.txt +++ b/doc/test/plugin/keyword.txt @@ -103,7 +103,7 @@ For your convenience here is also an inlined version of ``pytest_keyword.py``: result = testdir.runpytest(p) 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 .. _`plugins`: index.html .. _`contact`: ../../contact.html diff --git a/doc/test/plugin/monkeypatch.txt b/doc/test/plugin/monkeypatch.txt index 0de5b24ba..9ebef0f98 100644 --- a/doc/test/plugin/monkeypatch.txt +++ b/doc/test/plugin/monkeypatch.txt @@ -182,7 +182,7 @@ For your convenience here is also an inlined version of ``pytest_monkeypatch.py` res = reprec.countoutcomes() 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 .. _`plugins`: index.html .. _`contact`: ../../contact.html diff --git a/doc/test/plugin/pdb.txt b/doc/test/plugin/pdb.txt index 738201757..659319246 100644 --- a/doc/test/plugin/pdb.txt +++ b/doc/test/plugin/pdb.txt @@ -185,7 +185,7 @@ For your convenience here is also an inlined version of ``pytest_pdb.py``: if child.isalive(): 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 .. _`plugins`: index.html .. _`contact`: ../../contact.html diff --git a/doc/test/plugin/pocoo.txt b/doc/test/plugin/pocoo.txt index 3f38b4a99..0dbc66e7d 100644 --- a/doc/test/plugin/pocoo.txt +++ b/doc/test/plugin/pocoo.txt @@ -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 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 .. _`plugins`: index.html .. _`contact`: ../../contact.html diff --git a/doc/test/plugin/pytester.txt b/doc/test/plugin/pytester.txt index dd0480954..82d8607ec 100644 --- a/doc/test/plugin/pytester.txt +++ b/doc/test/plugin/pytester.txt @@ -561,7 +561,7 @@ For your convenience here is also an inlined version of ``pytest_pytester.py``: "*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 .. _`plugins`: index.html .. _`contact`: ../../contact.html diff --git a/doc/test/plugin/recwarn.txt b/doc/test/plugin/recwarn.txt index 762b1643d..c09078890 100644 --- a/doc/test/plugin/recwarn.txt +++ b/doc/test/plugin/recwarn.txt @@ -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) -.. _`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 .. _`plugins`: index.html .. _`contact`: ../../contact.html diff --git a/doc/test/plugin/restdoc.txt b/doc/test/plugin/restdoc.txt index 5ad00bbbe..b1b1ae015 100644 --- a/doc/test/plugin/restdoc.txt +++ b/doc/test/plugin/restdoc.txt @@ -524,7 +524,7 @@ For your convenience here is also an inlined version of ``pytest_restdoc.py``: assert not failed 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 .. _`plugins`: index.html .. _`contact`: ../../contact.html diff --git a/doc/test/plugin/resultlog.txt b/doc/test/plugin/resultlog.txt index 31dc1e97c..0d0d72900 100644 --- a/doc/test/plugin/resultlog.txt +++ b/doc/test/plugin/resultlog.txt @@ -274,7 +274,7 @@ For your convenience here is also an inlined version of ``pytest_resultlog.py``: "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 .. _`plugins`: index.html .. _`contact`: ../../contact.html diff --git a/doc/test/plugin/runner.txt b/doc/test/plugin/runner.txt index cb0672e48..4548cb0fe 100644 --- a/doc/test/plugin/runner.txt +++ b/doc/test/plugin/runner.txt @@ -297,7 +297,7 @@ For your convenience here is also an inlined version of ``pytest_runner.py``: col.setup() 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 .. _`plugins`: index.html .. _`contact`: ../../contact.html diff --git a/doc/test/plugin/terminal.txt b/doc/test/plugin/terminal.txt index 342ce0fe6..de1ea85e7 100644 --- a/doc/test/plugin/terminal.txt +++ b/doc/test/plugin/terminal.txt @@ -425,7 +425,7 @@ For your convenience here is also an inlined version of ``pytest_terminal.py``: except (TypeError, ValueError): 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 .. _`plugins`: index.html .. _`contact`: ../../contact.html diff --git a/doc/test/plugin/unittest.txt b/doc/test/plugin/unittest.txt index 37bd77814..21784ad2b 100644 --- a/doc/test/plugin/unittest.txt +++ b/doc/test/plugin/unittest.txt @@ -4,14 +4,17 @@ pytest_unittest plugin automatically discover and run traditional "unittest.py" style tests. -you can mix unittest TestCase subclasses and -py.test style tests in one test module. +Usage +---------------- -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 --------------------------------- @@ -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. - you can mix unittest TestCase subclasses and - py.test style tests in one test module. + Usage + ---------------- - 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 - - http://johnnydebris.net/svn/projects/py_unittest + This plugin is enabled by default. + .. _`unittest.py style`: http://docs.python.org/library/unittest.html """ import py + import sys 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): 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 + 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 .. _`plugins`: index.html .. _`contact`: ../../contact.html diff --git a/doc/test/plugin/xfail.txt b/doc/test/plugin/xfail.txt index d63551a68..271f420dc 100644 --- a/doc/test/plugin/xfail.txt +++ b/doc/test/plugin/xfail.txt @@ -127,7 +127,7 @@ For your convenience here is also an inlined version of ``pytest_xfail.py``: ]) 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 .. _`plugins`: index.html .. _`contact`: ../../contact.html