diff --git a/doc/en/Makefile b/doc/en/Makefile index 7cfb6f1f8..58c3b54e3 100644 --- a/doc/en/Makefile +++ b/doc/en/Makefile @@ -21,6 +21,7 @@ REGENDOC_ARGS := \ --normalize "@(This is pytest version )(\d+)\\.[^ ,]+@\1\2.x.y@" \ --normalize "@py-(\d+)\\.[^ ,]+@py-\1.x.y@" \ --normalize "@pluggy-(\d+)\\.[.\d,]+@pluggy-\1.x.y@" \ + --normalize "@hypothesis-(\d+)\\.[.\d,]+@hypothesis-\1.x.y@" \ --normalize "@Python (\d+)\\.[^ ,]+@Python \1.x.y@" .PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest diff --git a/doc/en/assert.rst b/doc/en/assert.rst index d3d06804e..2d9f8bc8e 100644 --- a/doc/en/assert.rst +++ b/doc/en/assert.rst @@ -28,6 +28,7 @@ you will see the return value of the function call:: ======= test session starts ======== platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR, inifile: + plugins: hypothesis-3.x.y collected 1 items test_assert1.py F @@ -172,6 +173,7 @@ if you run this module:: ======= test session starts ======== platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR, inifile: + plugins: hypothesis-3.x.y collected 1 items test_assert2.py F diff --git a/doc/en/cache.rst b/doc/en/cache.rst index 688b6dd04..a273d292b 100644 --- a/doc/en/cache.rst +++ b/doc/en/cache.rst @@ -83,6 +83,7 @@ If you then run it with ``--lf``:: platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y run-last-failure: rerun last 2 failures rootdir: $REGENDOC_TMPDIR, inifile: + plugins: hypothesis-3.x.y collected 50 items test_50.py FF @@ -125,6 +126,7 @@ of ``FF`` and dots):: platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y run-last-failure: rerun last 2 failures first rootdir: $REGENDOC_TMPDIR, inifile: + plugins: hypothesis-3.x.y collected 50 items test_50.py FF................................................ @@ -229,6 +231,7 @@ You can always peek at the content of the cache using the ======= test session starts ======== platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR, inifile: + plugins: hypothesis-3.x.y cachedir: $REGENDOC_TMPDIR/.cache ------------------------------- cache values ------------------------------- cache/lastfailed contains: diff --git a/doc/en/capture.rst b/doc/en/capture.rst index 58ebdf840..a7e9c879d 100644 --- a/doc/en/capture.rst +++ b/doc/en/capture.rst @@ -66,6 +66,7 @@ of the failing function and hide the other one:: ======= test session starts ======== platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR, inifile: + plugins: hypothesis-3.x.y collected 2 items test_module.py .F diff --git a/doc/en/doctest.rst b/doc/en/doctest.rst index 24c068a86..35f4dc984 100644 --- a/doc/en/doctest.rst +++ b/doc/en/doctest.rst @@ -64,6 +64,7 @@ then you can just invoke ``pytest`` without command line options:: ======= test session starts ======== platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR, inifile: pytest.ini + plugins: hypothesis-3.x.y collected 1 items mymodule.py . diff --git a/doc/en/example/markers.rst b/doc/en/example/markers.rst index 338f707a5..a28336c37 100644 --- a/doc/en/example/markers.rst +++ b/doc/en/example/markers.rst @@ -31,9 +31,10 @@ You can then restrict a test run to only run tests marked with ``webtest``:: $ pytest -v -m webtest ======= test session starts ======== - platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.5 + platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3 cachedir: .cache rootdir: $REGENDOC_TMPDIR, inifile: + plugins: hypothesis-3.x.y collecting ... collected 4 items test_server.py::test_send_http PASSED @@ -45,9 +46,10 @@ Or the inverse, running all tests except the webtest ones:: $ pytest -v -m "not webtest" ======= test session starts ======== - platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.5 + platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3 cachedir: .cache rootdir: $REGENDOC_TMPDIR, inifile: + plugins: hypothesis-3.x.y collecting ... collected 4 items test_server.py::test_something_quick PASSED @@ -66,9 +68,10 @@ tests based on their module, class, method, or function name:: $ pytest -v test_server.py::TestClass::test_method ======= test session starts ======== - platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.5 + platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3 cachedir: .cache rootdir: $REGENDOC_TMPDIR, inifile: + plugins: hypothesis-3.x.y collecting ... collected 5 items test_server.py::TestClass::test_method PASSED @@ -79,9 +82,10 @@ You can also select on the class:: $ pytest -v test_server.py::TestClass ======= test session starts ======== - platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.5 + platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3 cachedir: .cache rootdir: $REGENDOC_TMPDIR, inifile: + plugins: hypothesis-3.x.y collecting ... collected 4 items test_server.py::TestClass::test_method PASSED @@ -92,9 +96,10 @@ Or select multiple nodes:: $ pytest -v test_server.py::TestClass test_server.py::test_send_http ======= test session starts ======== - platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.5 + platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3 cachedir: .cache rootdir: $REGENDOC_TMPDIR, inifile: + plugins: hypothesis-3.x.y collecting ... collected 8 items test_server.py::TestClass::test_method PASSED @@ -130,9 +135,10 @@ select tests based on their names:: $ pytest -v -k http # running with the above defined example module ======= test session starts ======== - platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.5 + platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3 cachedir: .cache rootdir: $REGENDOC_TMPDIR, inifile: + plugins: hypothesis-3.x.y collecting ... collected 4 items test_server.py::test_send_http PASSED @@ -144,9 +150,10 @@ And you can also run all tests except the ones that match the keyword:: $ pytest -k "not send_http" -v ======= test session starts ======== - platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.5 + platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3 cachedir: .cache rootdir: $REGENDOC_TMPDIR, inifile: + plugins: hypothesis-3.x.y collecting ... collected 4 items test_server.py::test_something_quick PASSED @@ -160,9 +167,10 @@ Or to select "http" and "quick" tests:: $ pytest -k "http or quick" -v ======= test session starts ======== - platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.5 + platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3 cachedir: .cache rootdir: $REGENDOC_TMPDIR, inifile: + plugins: hypothesis-3.x.y collecting ... collected 4 items test_server.py::test_send_http PASSED @@ -201,6 +209,8 @@ You can ask which markers exist for your test suite - the list includes our just $ pytest --markers @pytest.mark.webtest: mark a test as a webtest. + @pytest.mark.hypothesis: Tests which use hypothesis. + @pytest.mark.skip(reason=None): skip the given test function with an optional reason. Example: skip(reason="no way of currently testing this") skips the test. @pytest.mark.skipif(condition): skip the given test function if eval(condition) results in a True value. Evaluation happens within the module global context. Example: skipif('sys.platform == "win32"') skips the test if we are on the win32 platform. see http://pytest.org/latest/skipping.html @@ -354,6 +364,7 @@ the test needs:: ======= test session starts ======== platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR, inifile: + plugins: hypothesis-3.x.y collected 1 items test_someenv.py s @@ -366,6 +377,7 @@ and here is one that specifies exactly the environment needed:: ======= test session starts ======== platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR, inifile: + plugins: hypothesis-3.x.y collected 1 items test_someenv.py . @@ -377,6 +389,8 @@ The ``--markers`` option always gives you a list of available markers:: $ pytest --markers @pytest.mark.env(name): mark test to run only on named environment + @pytest.mark.hypothesis: Tests which use hypothesis. + @pytest.mark.skip(reason=None): skip the given test function with an optional reason. Example: skip(reason="no way of currently testing this") skips the test. @pytest.mark.skipif(condition): skip the given test function if eval(condition) results in a True value. Evaluation happens within the module global context. Example: skipif('sys.platform == "win32"') skips the test if we are on the win32 platform. see http://pytest.org/latest/skipping.html @@ -487,6 +501,7 @@ then you will see two tests skipped and two executed tests as expected:: ======= test session starts ======== platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR, inifile: + plugins: hypothesis-3.x.y collected 4 items test_plat.py s.s. @@ -501,6 +516,7 @@ Note that if you specify a platform via the marker-command line option like this ======= test session starts ======== platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR, inifile: + plugins: hypothesis-3.x.y collected 4 items test_plat.py . @@ -553,6 +569,7 @@ We can now use the ``-m option`` to select one set:: ======= test session starts ======== platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR, inifile: + plugins: hypothesis-3.x.y collected 4 items test_module.py FF @@ -575,6 +592,7 @@ or to select both "event" and "interface" tests:: ======= test session starts ======== platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR, inifile: + plugins: hypothesis-3.x.y collected 4 items test_module.py FFF diff --git a/doc/en/example/nonpython.rst b/doc/en/example/nonpython.rst index 5784f6ed6..fd3fc1f92 100644 --- a/doc/en/example/nonpython.rst +++ b/doc/en/example/nonpython.rst @@ -29,16 +29,16 @@ now execute the test specification:: ======= test session starts ======== platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR/nonpython, inifile: - collected 2 items + plugins: hypothesis-3.x.y + collected 0 items / 1 errors - test_simple.yml F. - - ======= FAILURES ======== - _______ usecase: hello ________ - usecase execution failed - spec failed: 'some': 'other' - no further details known at this point. - ======= 1 failed, 1 passed in 0.12 seconds ======== + ======= ERRORS ======== + _______ ERROR collecting test_simple.yml ________ + conftest.py:11: in collect + import yaml # we need a yaml parser, e.g. PyYAML + E ImportError: No module named 'yaml' + !!!!!!!!!!!!!!!!! Interrupted: 1 errors during collection !!!!!!!!!!!!!!!!!! + ======= 1 error in 0.12 seconds ======== .. regendoc:wipe @@ -59,20 +59,19 @@ consulted when reporting in ``verbose`` mode:: nonpython $ pytest -v ======= test session starts ======== - platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.5 + platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3 cachedir: .cache rootdir: $REGENDOC_TMPDIR/nonpython, inifile: - collecting ... collected 2 items + plugins: hypothesis-3.x.y + collecting ... collected 0 items / 1 errors - test_simple.yml::hello FAILED - test_simple.yml::ok PASSED - - ======= FAILURES ======== - _______ usecase: hello ________ - usecase execution failed - spec failed: 'some': 'other' - no further details known at this point. - ======= 1 failed, 1 passed in 0.12 seconds ======== + ======= ERRORS ======== + _______ ERROR collecting test_simple.yml ________ + conftest.py:11: in collect + import yaml # we need a yaml parser, e.g. PyYAML + E ImportError: No module named 'yaml' + !!!!!!!!!!!!!!!!! Interrupted: 1 errors during collection !!!!!!!!!!!!!!!!!! + ======= 1 error in 0.12 seconds ======== .. regendoc:wipe @@ -83,9 +82,13 @@ interesting to just look at the collection tree:: ======= test session starts ======== platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR/nonpython, inifile: - collected 2 items - - - + plugins: hypothesis-3.x.y + collected 0 items / 1 errors - ======= no tests ran in 0.12 seconds ======== + ======= ERRORS ======== + _______ ERROR collecting test_simple.yml ________ + conftest.py:11: in collect + import yaml # we need a yaml parser, e.g. PyYAML + E ImportError: No module named 'yaml' + !!!!!!!!!!!!!!!!! Interrupted: 1 errors during collection !!!!!!!!!!!!!!!!!! + ======= 1 error in 0.12 seconds ======== diff --git a/doc/en/example/parametrize.rst b/doc/en/example/parametrize.rst index 8d92517b9..2ab72da03 100644 --- a/doc/en/example/parametrize.rst +++ b/doc/en/example/parametrize.rst @@ -132,6 +132,7 @@ objects, they are still using the default pytest representation:: ======= test session starts ======== platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR, inifile: + plugins: hypothesis-3.x.y collected 6 items @@ -183,6 +184,7 @@ this is a fully self-contained example which you can run with:: ======= test session starts ======== platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR, inifile: + plugins: hypothesis-3.x.y collected 4 items test_scenarios.py .... @@ -196,6 +198,7 @@ If you just collect tests you'll also nicely see 'advanced' and 'basic' as varia ======= test session starts ======== platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR, inifile: + plugins: hypothesis-3.x.y collected 4 items @@ -261,6 +264,7 @@ Let's first see how it looks like at collection time:: ======= test session starts ======== platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR, inifile: + plugins: hypothesis-3.x.y collected 2 items @@ -322,6 +326,7 @@ The result of this test will be successful:: ======= test session starts ======== platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR, inifile: + plugins: hypothesis-3.x.y collected 1 items @@ -397,32 +402,8 @@ is to be run with different sets of arguments for its three arguments: Running it results in some skips if we don't have all the python interpreters installed and otherwise runs all combinations (5 interpreters times 5 interpreters times 3 objects to serialize/deserialize):: . $ pytest -rs -q multipython.py - Traceback (most recent call last): - File "$PYTHON_PREFIX/lib/python3.5/site-packages/_pytest/config.py", line 326, in _getconftestmodules - return self._path2confmods[path] - KeyError: local('$REGENDOC_TMPDIR/CWD/multipython.py') - - During handling of the above exception, another exception occurred: - Traceback (most recent call last): - File "$PYTHON_PREFIX/lib/python3.5/site-packages/_pytest/config.py", line 326, in _getconftestmodules - return self._path2confmods[path] - KeyError: local('$REGENDOC_TMPDIR/CWD') - - During handling of the above exception, another exception occurred: - Traceback (most recent call last): - File "$PYTHON_PREFIX/lib/python3.5/site-packages/_pytest/config.py", line 357, in _importconftest - return self._conftestpath2mod[conftestpath] - KeyError: local('$REGENDOC_TMPDIR/CWD/conftest.py') - - During handling of the above exception, another exception occurred: - Traceback (most recent call last): - File "$PYTHON_PREFIX/lib/python3.5/site-packages/_pytest/config.py", line 363, in _importconftest - mod = conftestpath.pyimport() - File "$PYTHON_PREFIX/lib/python3.5/site-packages/py/_path/local.py", line 680, in pyimport - raise self.ImportMismatchError(modname, modfile, self) - py._path.local.LocalPath.ImportMismatchError: ('conftest', '$PWD/example/conftest.py', local('$REGENDOC_TMPDIR/CWD/conftest.py')) - ERROR: could not load $REGENDOC_TMPDIR/CWD/conftest.py - + ................................................ + 48 passed in 0.12 seconds Indirect parametrization of optional implementations/imports -------------------------------------------------------------------- @@ -471,6 +452,7 @@ If you run this with reporting for skips enabled:: ======= test session starts ======== platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR, inifile: + plugins: hypothesis-3.x.y collected 2 items test_module.py .s diff --git a/doc/en/example/pythoncollection.rst b/doc/en/example/pythoncollection.rst index 1668de8ae..86a96db5a 100644 --- a/doc/en/example/pythoncollection.rst +++ b/doc/en/example/pythoncollection.rst @@ -119,6 +119,7 @@ then the test collection looks like this:: ======= test session starts ======== platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR, inifile: pytest.ini + plugins: hypothesis-3.x.y collected 2 items @@ -162,32 +163,19 @@ Finding out what is collected You can always peek at the collection tree without running tests like this:: . $ pytest --collect-only pythoncollection.py - Traceback (most recent call last): - File "$PYTHON_PREFIX/lib/python3.5/site-packages/_pytest/config.py", line 326, in _getconftestmodules - return self._path2confmods[path] - KeyError: local('$REGENDOC_TMPDIR/CWD/pythoncollection.py') - - During handling of the above exception, another exception occurred: - Traceback (most recent call last): - File "$PYTHON_PREFIX/lib/python3.5/site-packages/_pytest/config.py", line 326, in _getconftestmodules - return self._path2confmods[path] - KeyError: local('$REGENDOC_TMPDIR/CWD') - - During handling of the above exception, another exception occurred: - Traceback (most recent call last): - File "$PYTHON_PREFIX/lib/python3.5/site-packages/_pytest/config.py", line 357, in _importconftest - return self._conftestpath2mod[conftestpath] - KeyError: local('$REGENDOC_TMPDIR/CWD/conftest.py') - - During handling of the above exception, another exception occurred: - Traceback (most recent call last): - File "$PYTHON_PREFIX/lib/python3.5/site-packages/_pytest/config.py", line 363, in _importconftest - mod = conftestpath.pyimport() - File "$PYTHON_PREFIX/lib/python3.5/site-packages/py/_path/local.py", line 680, in pyimport - raise self.ImportMismatchError(modname, modfile, self) - py._path.local.LocalPath.ImportMismatchError: ('conftest', '$PWD/example/conftest.py', local('$REGENDOC_TMPDIR/CWD/conftest.py')) - ERROR: could not load $REGENDOC_TMPDIR/CWD/conftest.py + ======= test session starts ======== + platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y + rootdir: $REGENDOC_TMPDIR, inifile: pytest.ini + plugins: hypothesis-3.x.y + collected 3 items + + + + + + + ======= no tests ran in 0.12 seconds ======== customizing test collection to find all .py files --------------------------------------------------------- @@ -246,6 +234,7 @@ will be left out:: ======= test session starts ======== platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR, inifile: pytest.ini + plugins: hypothesis-3.x.y collected 0 items ======= no tests ran in 0.12 seconds ======== diff --git a/doc/en/example/reportingdemo.rst b/doc/en/example/reportingdemo.rst index 47c18851d..3c3b6c01c 100644 --- a/doc/en/example/reportingdemo.rst +++ b/doc/en/example/reportingdemo.rst @@ -13,6 +13,7 @@ get on the terminal - we are working on that):: ======= test session starts ======== platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR/assertion, inifile: + plugins: hypothesis-3.x.y collected 42 items failure_demo.py FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF @@ -358,7 +359,7 @@ get on the terminal - we are working on that):: > int(s) E ValueError: invalid literal for int() with base 10: 'qwe' - <0-codegen $PYTHON_PREFIX/lib/python3.5/site-packages/_pytest/python.py:1219>:1: ValueError + <0-codegen /home/rpfannsc/Projects/pytest-dev/pytest/_pytest/python.py:1219>:1: ValueError _______ TestRaises.test_raises_doesnt ________ self = diff --git a/doc/en/example/simple.rst b/doc/en/example/simple.rst index 80fbf3f74..e93f1a0da 100644 --- a/doc/en/example/simple.rst +++ b/doc/en/example/simple.rst @@ -115,6 +115,7 @@ directory with the above conftest.py:: ======= test session starts ======== platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR, inifile: + plugins: hypothesis-3.x.y collected 0 items ======= no tests ran in 0.12 seconds ======== @@ -166,6 +167,7 @@ and when running it will see a skipped "slow" test:: ======= test session starts ======== platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR, inifile: + plugins: hypothesis-3.x.y collected 2 items test_module.py .s @@ -180,6 +182,7 @@ Or run it including the ``slow`` marked test:: ======= test session starts ======== platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR, inifile: + plugins: hypothesis-3.x.y collected 2 items test_module.py .. @@ -305,6 +308,7 @@ which will add the string to the test header accordingly:: platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y project deps: mylib-1.1 rootdir: $REGENDOC_TMPDIR, inifile: + plugins: hypothesis-3.x.y collected 0 items ======= no tests ran in 0.12 seconds ======== @@ -327,11 +331,12 @@ which will add info only when run with "--v":: $ pytest -v ======= test session starts ======== - platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.5 + platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3 cachedir: .cache info1: did you know that ... did you? rootdir: $REGENDOC_TMPDIR, inifile: + plugins: hypothesis-3.x.y collecting ... collected 0 items ======= no tests ran in 0.12 seconds ======== @@ -342,6 +347,7 @@ and nothing when run plainly:: ======= test session starts ======== platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR, inifile: + plugins: hypothesis-3.x.y collected 0 items ======= no tests ran in 0.12 seconds ======== @@ -376,6 +382,7 @@ Now we can profile which test functions execute the slowest:: ======= test session starts ======== platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR, inifile: + plugins: hypothesis-3.x.y collected 3 items test_some_are_slow.py ... @@ -383,7 +390,7 @@ Now we can profile which test functions execute the slowest:: ======= slowest 3 test durations ======== 0.20s call test_some_are_slow.py::test_funcslow2 0.10s call test_some_are_slow.py::test_funcslow1 - 0.00s setup test_some_are_slow.py::test_funcslow2 + 0.00s teardown test_some_are_slow.py::test_funcslow2 ======= 3 passed in 0.12 seconds ======== incremental testing - test steps @@ -442,6 +449,7 @@ If we run this:: ======= test session starts ======== platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR, inifile: + plugins: hypothesis-3.x.y collected 4 items test_step.py .Fx. @@ -521,6 +529,7 @@ We can run this:: ======= test session starts ======== platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR, inifile: + plugins: hypothesis-3.x.y collected 7 items test_step.py .Fx. @@ -629,6 +638,7 @@ and run them:: ======= test session starts ======== platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR, inifile: + plugins: hypothesis-3.x.y collected 2 items test_module.py FF @@ -723,6 +733,7 @@ and run it:: ======= test session starts ======== platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR, inifile: + plugins: hypothesis-3.x.y collected 3 items test_module.py Esetting up a test failed! test_module.py::test_setup_fails diff --git a/doc/en/fixture.rst b/doc/en/fixture.rst index f760c423e..13e0f3930 100644 --- a/doc/en/fixture.rst +++ b/doc/en/fixture.rst @@ -72,6 +72,7 @@ marked ``smtp`` fixture function. Running the test looks like this:: ======= test session starts ======== platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR, inifile: + plugins: hypothesis-3.x.y collected 1 items test_smtpsimple.py F @@ -190,6 +191,7 @@ inspect what is going on and can now run the tests:: ======= test session starts ======== platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR, inifile: + plugins: hypothesis-3.x.y collected 2 items test_module.py FF @@ -525,6 +527,7 @@ Running the above tests results in the following test IDs being used:: ======= test session starts ======== platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR, inifile: + plugins: hypothesis-3.x.y collected 10 items @@ -574,9 +577,10 @@ Here we declare an ``app`` fixture which receives the previously defined $ pytest -v test_appsetup.py ======= test session starts ======== - platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.5 + platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3 cachedir: .cache rootdir: $REGENDOC_TMPDIR, inifile: + plugins: hypothesis-3.x.y collecting ... collected 2 items test_appsetup.py::test_smtp_exists[smtp.gmail.com] PASSED @@ -643,9 +647,10 @@ Let's run the tests in verbose mode and with looking at the print-output:: $ pytest -v -s test_module.py ======= test session starts ======== - platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.5 + platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3 cachedir: .cache rootdir: $REGENDOC_TMPDIR, inifile: + plugins: hypothesis-3.x.y collecting ... collected 8 items test_module.py::test_0[1] SETUP otherarg 1 diff --git a/doc/en/getting-started.rst b/doc/en/getting-started.rst index 59abd4c79..07e92aeaf 100644 --- a/doc/en/getting-started.rst +++ b/doc/en/getting-started.rst @@ -26,7 +26,9 @@ Installation:: To check your installation has installed the correct version:: $ pytest --version - This is pytest version 3.x.y, imported from $PYTHON_PREFIX/lib/python3.5/site-packages/pytest.py + This is pytest version 3.x.y, imported from /home/rpfannsc/Projects/pytest-dev/pytest/pytest.py + setuptools registered plugins: + hypothesis-3.x.y at $PYTHON_PREFIX/lib/python3.5/site-packages/hypothesis/extra/pytestplugin.py .. _`simpletest`: @@ -48,6 +50,7 @@ That's it. You can execute the test function now:: ======= test session starts ======== platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR, inifile: + plugins: hypothesis-3.x.y collected 1 items test_sample.py F diff --git a/doc/en/index.rst b/doc/en/index.rst index cb901b8d5..c4f2ba28c 100644 --- a/doc/en/index.rst +++ b/doc/en/index.rst @@ -27,6 +27,7 @@ To execute it:: ======= test session starts ======== platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR, inifile: + plugins: hypothesis-3.x.y collected 1 items test_sample.py F diff --git a/doc/en/parametrize.rst b/doc/en/parametrize.rst index fc048fb08..857006e9b 100644 --- a/doc/en/parametrize.rst +++ b/doc/en/parametrize.rst @@ -57,6 +57,7 @@ them in turn:: ======= test session starts ======== platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR, inifile: + plugins: hypothesis-3.x.y collected 3 items test_expectation.py ..F @@ -126,6 +127,7 @@ Let's run this:: ======= test session starts ======== platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR, inifile: + plugins: hypothesis-3.x.y collected 3 items test_expectation.py ..x diff --git a/doc/en/skipping.rst b/doc/en/skipping.rst index 8e9ef3c7f..1dd1ac2a4 100644 --- a/doc/en/skipping.rst +++ b/doc/en/skipping.rst @@ -223,32 +223,28 @@ Here is a simple test file with the several usages: Running it with the report-on-xfail option gives this output:: example $ pytest -rx xfail_demo.py - Traceback (most recent call last): - File "$PYTHON_PREFIX/lib/python3.5/site-packages/_pytest/config.py", line 326, in _getconftestmodules - return self._path2confmods[path] - KeyError: local('$REGENDOC_TMPDIR/example/xfail_demo.py') + ======= test session starts ======== + platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y + rootdir: $REGENDOC_TMPDIR/example, inifile: + plugins: hypothesis-3.x.y + collected 7 items - During handling of the above exception, another exception occurred: - Traceback (most recent call last): - File "$PYTHON_PREFIX/lib/python3.5/site-packages/_pytest/config.py", line 326, in _getconftestmodules - return self._path2confmods[path] - KeyError: local('$REGENDOC_TMPDIR/example') - - During handling of the above exception, another exception occurred: - Traceback (most recent call last): - File "$PYTHON_PREFIX/lib/python3.5/site-packages/_pytest/config.py", line 357, in _importconftest - return self._conftestpath2mod[conftestpath] - KeyError: local('$REGENDOC_TMPDIR/example/conftest.py') - - During handling of the above exception, another exception occurred: - Traceback (most recent call last): - File "$PYTHON_PREFIX/lib/python3.5/site-packages/_pytest/config.py", line 363, in _importconftest - mod = conftestpath.pyimport() - File "$PYTHON_PREFIX/lib/python3.5/site-packages/py/_path/local.py", line 680, in pyimport - raise self.ImportMismatchError(modname, modfile, self) - py._path.local.LocalPath.ImportMismatchError: ('conftest', '$PWD/example/conftest.py', local('$REGENDOC_TMPDIR/example/conftest.py')) - ERROR: could not load $REGENDOC_TMPDIR/example/conftest.py + xfail_demo.py xxxxxxx + ======= short test summary info ======== + XFAIL xfail_demo.py::test_hello + XFAIL xfail_demo.py::test_hello2 + reason: [NOTRUN] + XFAIL xfail_demo.py::test_hello3 + condition: hasattr(os, 'sep') + XFAIL xfail_demo.py::test_hello4 + bug 110 + XFAIL xfail_demo.py::test_hello5 + condition: pytest.__version__[0] != "17" + XFAIL xfail_demo.py::test_hello6 + reason: reason + XFAIL xfail_demo.py::test_hello7 + ======= 7 xfailed in 0.12 seconds ======== xfail signature summary ~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/doc/en/tmpdir.rst b/doc/en/tmpdir.rst index 642bb0814..82b333877 100644 --- a/doc/en/tmpdir.rst +++ b/doc/en/tmpdir.rst @@ -31,6 +31,7 @@ Running this would result in a passed test except for the last ======= test session starts ======== platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR, inifile: + plugins: hypothesis-3.x.y collected 1 items test_tmpdir.py F diff --git a/doc/en/unittest.rst b/doc/en/unittest.rst index 6ee7d505e..8164b4243 100644 --- a/doc/en/unittest.rst +++ b/doc/en/unittest.rst @@ -110,6 +110,7 @@ the ``self.db`` values in the traceback:: ======= test session starts ======== platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR, inifile: + plugins: hypothesis-3.x.y collected 2 items test_unittest_db.py FF diff --git a/doc/en/warnings.rst b/doc/en/warnings.rst index fb18c4a2f..b9c680ead 100644 --- a/doc/en/warnings.rst +++ b/doc/en/warnings.rst @@ -24,6 +24,7 @@ Running pytest now produces this output:: ======= test session starts ======== platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR, inifile: + plugins: hypothesis-3.x.y collected 1 items test_show_warnings.py .