diff --git a/CHANGELOG.rst b/CHANGELOG.rst index b72db97a9..d8186e659 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -8,6 +8,138 @@ .. towncrier release notes start +Pytest 3.4.0 (2018-01-30) +========================= + +Deprecations and Removals +------------------------- + +- All pytest classes now subclass ``object`` for better Python 3 compatibility. + This should not affect user code except in very rare edge cases. (`#2147 + `_) + + +Features +-------- + +- Introduce ``empty_parameter_set_mark`` ini option to select which mark to + apply when ``@pytest.mark.parametrize`` is given an empty set of parameters. + Valid options are ``skip`` (default) and ``xfail``. Note that it is planned + to change the default to ``xfail`` in future releases as this is considered + less error prone. (`#2527 + `_) + +- **Incompatible change**: after community feedback the `logging + `_ functionality has + undergone some changes. Please consult the `logging documentation + `_ + for details. (`#3013 `_) + +- Console output fallsback to "classic" mode when capture is disabled (``-s``), + otherwise the output gets garbled to the point of being useless. (`#3038 + `_) + +- New `pytest_runtest_logfinish + `_ + hook which is called when a test item has finished executing, analogous to + `pytest_runtest_logstart + `_. + (`#3101 `_) + +- Improve performance when collecting tests using many fixtures. (`#3107 + `_) + +- New ``caplog.get_records(when)`` method which provides access the captured + records during each testing stage: ``"setup"``, ``"call"`` and ``"teardown"`` + stages. (`#3117 `_) + +- New fixture ``record_xml_attribute`` that allows modifying and inserting + attributes on the ```` xml node in JUnit reports. (`#3130 + `_) + +- The default cache directory has been renamed from ``.cache`` to + ``.pytest_cache`` after community feedback that the name ``.cache`` did not + make it clear that it was used by pytest. (`#3138 + `_) + +- Colorize the levelname column in the live-log output. (`#3142 + `_) + + +Bug Fixes +--------- + +- Fixed hanging pexpect test on MacOS by using flush() instead of wait(). + (`#2022 `_) + +- Fixed restoring Python state after in-process pytest runs with the + ``pytester`` plugin; this may break tests using making multiple inprocess + pytest runs if later ones depend on earlier ones leaking global interpreter + changes. (`#3016 `_) + +- Fix skipping plugin reporting hook when test aborted before plugin setup + hook. (`#3074 `_) + +- Fix progress percentage reported when tests fail during teardown. (`#3088 + `_) + +- **Incompatible change**: ``-o/--override`` option no longer eats all the + remaining options, which can lead to surprising behavior: for example, + ``pytest -o foo=1 /path/to/test.py`` would fail because ``/path/to/test.py`` + would be considered as part of the ``-o`` command-line argument. One + consequence of this is that now multiple configuration overrides need + multiple ``-o`` flags: ``pytest -o foo=1 -o bar=2``. (`#3103 + `_) + + +Improved Documentation +---------------------- + +- Document hooks (defined with ``historic=True``) which cannot be used with + ``hookwrapper=True``. (`#2423 + `_) + +- Clarify that warning capturing doesn't change the warning filter by default. + (`#2457 `_) + +- Clarify a possible confusion when using pytest_fixture_setup with fixture + functions that return None. (`#2698 + `_) + +- Fix the wording of a sentence on doctest flags use in pytest. (`#3076 + `_) + +- Prefer ``https://*.readthedocs.io`` over ``http://*.rtfd.org`` for links in + the documentation. (`#3092 + `_) + +- Improve readability (wording, grammar) of Getting Started guide (`#3131 + `_) + +- Added note that calling pytest.main multiple times from the same process is + not recommended because of import caching. (`#3143 + `_) + + +Trivial/Internal Changes +------------------------ + +- Show a simple and easy error when keyword expressions trigger a syntax error + (for example, ``"-k foo and import"`` will show an error that you can not use + the ``import`` keyword in expressions). (`#2953 + `_) + +- Change parametrized automatic test id generation to use the ``__name__`` + attribute of functions instead of the fallback argument name plus counter. + (`#2976 `_) + +- Replace py.std with stdlib imports. (`#3067 + `_) + +- Corrected 'you' to 'your' in logging docs. (`#3129 + `_) + + Pytest 3.3.2 (2017-12-25) ========================= diff --git a/changelog/2022.bugfix b/changelog/2022.bugfix deleted file mode 100644 index 67c9c8f77..000000000 --- a/changelog/2022.bugfix +++ /dev/null @@ -1 +0,0 @@ -Fixed hanging pexpect test on MacOS by using flush() instead of wait(). \ No newline at end of file diff --git a/changelog/2147.removal b/changelog/2147.removal deleted file mode 100644 index 8d2cfed51..000000000 --- a/changelog/2147.removal +++ /dev/null @@ -1 +0,0 @@ -All pytest classes now subclass ``object`` for better Python 3 compatibility. This should not affect user code except in very rare edge cases. diff --git a/changelog/2423.doc b/changelog/2423.doc deleted file mode 100644 index 96cc68297..000000000 --- a/changelog/2423.doc +++ /dev/null @@ -1 +0,0 @@ -Document hooks (defined with ``historic=True``) which cannot be used with ``hookwrapper=True``. diff --git a/changelog/2457.doc b/changelog/2457.doc deleted file mode 100644 index 31d7aa1c2..000000000 --- a/changelog/2457.doc +++ /dev/null @@ -1 +0,0 @@ -Clarify that warning capturing doesn't change the warning filter by default. \ No newline at end of file diff --git a/changelog/2527.feature b/changelog/2527.feature deleted file mode 100644 index ed00398d9..000000000 --- a/changelog/2527.feature +++ /dev/null @@ -1 +0,0 @@ -Introduce ``empty_parameter_set_mark`` ini option to select which mark to apply when ``@pytest.mark.parametrize`` is given an empty set of parameters. Valid options are ``skip`` (default) and ``xfail``. Note that it is planned to change the default to ``xfail`` in future releases as this is considered less error prone. \ No newline at end of file diff --git a/changelog/2698.doc b/changelog/2698.doc deleted file mode 100644 index 3088b6efc..000000000 --- a/changelog/2698.doc +++ /dev/null @@ -1 +0,0 @@ -Clarify a possible confusion when using pytest_fixture_setup with fixture functions that return None. \ No newline at end of file diff --git a/changelog/2953.trivial b/changelog/2953.trivial deleted file mode 100644 index 25d9115c1..000000000 --- a/changelog/2953.trivial +++ /dev/null @@ -1 +0,0 @@ -Show a simple and easy error when keyword expressions trigger a syntax error (for example, ``"-k foo and import"`` will show an error that you can not use the ``import`` keyword in expressions). diff --git a/changelog/2976.trivial b/changelog/2976.trivial deleted file mode 100644 index 5f767dd27..000000000 --- a/changelog/2976.trivial +++ /dev/null @@ -1 +0,0 @@ -Change parametrized automatic test id generation to use the ``__name__`` attribute of functions instead of the fallback argument name plus counter. diff --git a/changelog/3013.feature b/changelog/3013.feature deleted file mode 100644 index b690961db..000000000 --- a/changelog/3013.feature +++ /dev/null @@ -1 +0,0 @@ -**Incompatible change**: after community feedback the `logging `_ functionality has undergone some changes. Please consult the `logging documentation `_ for details. diff --git a/changelog/3016.bugfix b/changelog/3016.bugfix deleted file mode 100644 index 1e2c86bdf..000000000 --- a/changelog/3016.bugfix +++ /dev/null @@ -1,2 +0,0 @@ -Fixed restoring Python state after in-process pytest runs with the ``pytester`` plugin; this may break tests using -making multiple inprocess pytest runs if later ones depend on earlier ones leaking global interpreter changes. diff --git a/changelog/3038.feature b/changelog/3038.feature deleted file mode 100644 index a0da2eef3..000000000 --- a/changelog/3038.feature +++ /dev/null @@ -1 +0,0 @@ -Console output fallsback to "classic" mode when capture is disabled (``-s``), otherwise the output gets garbled to the point of being useless. diff --git a/changelog/3067.trivial b/changelog/3067.trivial deleted file mode 100644 index 2b7185100..000000000 --- a/changelog/3067.trivial +++ /dev/null @@ -1 +0,0 @@ -Replace py.std with stdlib imports. diff --git a/changelog/3074.bugfix b/changelog/3074.bugfix deleted file mode 100644 index 814f26ff1..000000000 --- a/changelog/3074.bugfix +++ /dev/null @@ -1 +0,0 @@ -Fix skipping plugin reporting hook when test aborted before plugin setup hook. diff --git a/changelog/3076.doc b/changelog/3076.doc deleted file mode 100644 index 2958af781..000000000 --- a/changelog/3076.doc +++ /dev/null @@ -1 +0,0 @@ -Fix the wording of a sentence on doctest flags use in pytest. diff --git a/changelog/3088.bugfix b/changelog/3088.bugfix deleted file mode 100644 index 81b351571..000000000 --- a/changelog/3088.bugfix +++ /dev/null @@ -1 +0,0 @@ -Fix progress percentage reported when tests fail during teardown. diff --git a/changelog/3092.doc b/changelog/3092.doc deleted file mode 100644 index 6001b8e22..000000000 --- a/changelog/3092.doc +++ /dev/null @@ -1 +0,0 @@ -Prefer ``https://*.readthedocs.io`` over ``http://*.rtfd.org`` for links in the documentation. diff --git a/changelog/3101.feature b/changelog/3101.feature deleted file mode 100644 index 1ed0a8e08..000000000 --- a/changelog/3101.feature +++ /dev/null @@ -1,3 +0,0 @@ -New `pytest_runtest_logfinish `_ -hook which is called when a test item has finished executing, analogous to -`pytest_runtest_logstart `_. diff --git a/changelog/3103.bugfix b/changelog/3103.bugfix deleted file mode 100644 index 4bdb23820..000000000 --- a/changelog/3103.bugfix +++ /dev/null @@ -1 +0,0 @@ -**Incompatible change**: ``-o/--override`` option no longer eats all the remaining options, which can lead to surprising behavior: for example, ``pytest -o foo=1 /path/to/test.py`` would fail because ``/path/to/test.py`` would be considered as part of the ``-o`` command-line argument. One consequence of this is that now multiple configuration overrides need multiple ``-o`` flags: ``pytest -o foo=1 -o bar=2``. diff --git a/changelog/3107.feature b/changelog/3107.feature deleted file mode 100644 index 3a2e4e892..000000000 --- a/changelog/3107.feature +++ /dev/null @@ -1 +0,0 @@ -Improve performance when collecting tests using many fixtures. \ No newline at end of file diff --git a/changelog/3117.feature b/changelog/3117.feature deleted file mode 100644 index f428ed75d..000000000 --- a/changelog/3117.feature +++ /dev/null @@ -1 +0,0 @@ -New ``caplog.get_records(when)`` method which provides access the captured records during each testing stage: ``"setup"``, ``"call"`` and ``"teardown"`` stages. diff --git a/changelog/3129.trivial b/changelog/3129.trivial deleted file mode 100644 index 65958660c..000000000 --- a/changelog/3129.trivial +++ /dev/null @@ -1 +0,0 @@ -Corrected 'you' to 'your' in logging docs. diff --git a/changelog/3130.feature b/changelog/3130.feature deleted file mode 100644 index af2c23588..000000000 --- a/changelog/3130.feature +++ /dev/null @@ -1 +0,0 @@ -New fixture ``record_xml_attribute`` that allows modifying and inserting attributes on the ```` xml node in JUnit reports. diff --git a/changelog/3131.doc b/changelog/3131.doc deleted file mode 100644 index 28e61c1d8..000000000 --- a/changelog/3131.doc +++ /dev/null @@ -1 +0,0 @@ -Improve readability (wording, grammar) of Getting Started guide diff --git a/changelog/3138.feature b/changelog/3138.feature deleted file mode 100644 index 338d429f9..000000000 --- a/changelog/3138.feature +++ /dev/null @@ -1 +0,0 @@ -The default cache directory has been renamed from ``.cache`` to ``.pytest_cache`` after community feedback that the name ``.cache`` did not make it clear that it was used by pytest. diff --git a/changelog/3142.feature b/changelog/3142.feature deleted file mode 100644 index 1461be514..000000000 --- a/changelog/3142.feature +++ /dev/null @@ -1 +0,0 @@ -Colorize the levelname column in the live-log output. \ No newline at end of file diff --git a/changelog/3143.doc b/changelog/3143.doc deleted file mode 100644 index b454708ad..000000000 --- a/changelog/3143.doc +++ /dev/null @@ -1 +0,0 @@ -Added note that calling pytest.main multiple times from the same process is not recommended because of import caching. \ No newline at end of file diff --git a/doc/en/announce/index.rst b/doc/en/announce/index.rst index bc8d46f1f..4f3ec8b4e 100644 --- a/doc/en/announce/index.rst +++ b/doc/en/announce/index.rst @@ -6,6 +6,7 @@ Release announcements :maxdepth: 2 + release-3.4.0 release-3.3.2 release-3.3.1 release-3.3.0 diff --git a/doc/en/announce/release-3.4.0.rst b/doc/en/announce/release-3.4.0.rst new file mode 100644 index 000000000..df1e004f1 --- /dev/null +++ b/doc/en/announce/release-3.4.0.rst @@ -0,0 +1,52 @@ +pytest-3.4.0 +======================================= + +The pytest team is proud to announce the 3.4.0 release! + +pytest is a mature Python testing tool with more than a 1600 tests +against itself, passing on many different interpreters and platforms. + +This release contains a number of bugs fixes and improvements, so users are encouraged +to take a look at the CHANGELOG: + + http://doc.pytest.org/en/latest/changelog.html + +For complete documentation, please visit: + + http://docs.pytest.org + +As usual, you can upgrade from pypi via: + + pip install -U pytest + +Thanks to all who contributed to this release, among them: + +* Aaron +* Alan Velasco +* Anders Hovmöller +* Andrew Toolan +* Anthony Sottile +* Aron Coyle +* Brian Maissy +* Bruno Oliveira +* Cyrus Maden +* Florian Bruhin +* Henk-Jaap Wagenaar +* Ian Lesperance +* Jon Dufresne +* Jurko Gospodnetić +* Kate +* Kimberly +* Per A. Brodtkorb +* Pierre-Alexandre Fonta +* Raphael Castaneda +* Ronny Pfannschmidt +* ST John +* Segev Finer +* Thomas Hisch +* Tzu-ping Chung +* feuillemorte + + +Happy testing, +The Pytest Development Team diff --git a/doc/en/builtin.rst b/doc/en/builtin.rst index d11eb5606..a380b9abd 100644 --- a/doc/en/builtin.rst +++ b/doc/en/builtin.rst @@ -116,6 +116,10 @@ You can ask for available builtin or project-custom Add extra xml properties to the tag for the calling test. The fixture is callable with ``(name, value)``, with value being automatically xml-encoded. + record_xml_attribute + Add extra xml attributes to the tag for the calling test. + The fixture is callable with ``(name, value)``, with value being automatically + xml-encoded caplog Access and control log capturing. diff --git a/doc/en/cache.rst b/doc/en/cache.rst index c88721b11..e3423e95b 100644 --- a/doc/en/cache.rst +++ b/doc/en/cache.rst @@ -225,7 +225,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: - cachedir: $REGENDOC_TMPDIR/.cache + cachedir: $REGENDOC_TMPDIR/.pytest_cache ------------------------------- cache values ------------------------------- cache/lastfailed contains: {'test_caching.py::test_function': True} diff --git a/doc/en/example/markers.rst b/doc/en/example/markers.rst index 43c20d5b7..cbbb34633 100644 --- a/doc/en/example/markers.rst +++ b/doc/en/example/markers.rst @@ -32,7 +32,7 @@ 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 - cachedir: .cache + cachedir: .pytest_cache rootdir: $REGENDOC_TMPDIR, inifile: collecting ... collected 4 items @@ -46,7 +46,7 @@ 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 - cachedir: .cache + cachedir: .pytest_cache rootdir: $REGENDOC_TMPDIR, inifile: collecting ... collected 4 items @@ -67,7 +67,7 @@ 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 - cachedir: .cache + cachedir: .pytest_cache rootdir: $REGENDOC_TMPDIR, inifile: collecting ... collected 1 item @@ -80,7 +80,7 @@ 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 - cachedir: .cache + cachedir: .pytest_cache rootdir: $REGENDOC_TMPDIR, inifile: collecting ... collected 1 item @@ -93,7 +93,7 @@ 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 - cachedir: .cache + cachedir: .pytest_cache rootdir: $REGENDOC_TMPDIR, inifile: collecting ... collected 2 items @@ -131,7 +131,7 @@ 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 - cachedir: .cache + cachedir: .pytest_cache rootdir: $REGENDOC_TMPDIR, inifile: collecting ... collected 4 items @@ -145,7 +145,7 @@ 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 - cachedir: .cache + cachedir: .pytest_cache rootdir: $REGENDOC_TMPDIR, inifile: collecting ... collected 4 items @@ -161,7 +161,7 @@ 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 - cachedir: .cache + cachedir: .pytest_cache rootdir: $REGENDOC_TMPDIR, inifile: collecting ... collected 4 items @@ -432,7 +432,7 @@ The output is as follows:: $ pytest -q -s Marker info name=my_marker args=(,) kwars={} - . [100%] + . 1 passed in 0.12 seconds We can see that the custom marker has its argument set extended with the function ``hello_world``. This is the key difference between creating a custom marker as a callable, which invokes ``__call__`` behind the scenes, and using ``with_args``. @@ -477,7 +477,7 @@ Let's run this without capturing output and see what we get:: glob args=('function',) kwargs={'x': 3} glob args=('class',) kwargs={'x': 2} glob args=('module',) kwargs={'x': 1} - . [100%] + . 1 passed in 0.12 seconds marking platform specific tests with pytest diff --git a/doc/en/example/nonpython.rst b/doc/en/example/nonpython.rst index cf72c7219..dd25e888f 100644 --- a/doc/en/example/nonpython.rst +++ b/doc/en/example/nonpython.rst @@ -60,7 +60,7 @@ 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 - cachedir: .cache + cachedir: .pytest_cache rootdir: $REGENDOC_TMPDIR/nonpython, inifile: collecting ... collected 2 items diff --git a/doc/en/example/reportingdemo.rst b/doc/en/example/reportingdemo.rst index 9964d67f2..b0c25dedc 100644 --- a/doc/en/example/reportingdemo.rst +++ b/doc/en/example/reportingdemo.rst @@ -411,6 +411,8 @@ get on the terminal - we are working on that):: ____________________ test_dynamic_compile_shows_nicely _____________________ def test_dynamic_compile_shows_nicely(): + import imp + import sys src = 'def foo():\n assert 1 == 0\n' name = 'abc-123' module = imp.new_module(name) @@ -419,14 +421,14 @@ get on the terminal - we are working on that):: sys.modules[name] = module > module.foo() - failure_demo.py:166: + failure_demo.py:168: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ def foo(): > assert 1 == 0 E AssertionError - <2-codegen 'abc-123' $REGENDOC_TMPDIR/assertion/failure_demo.py:163>:2: AssertionError + <2-codegen 'abc-123' $REGENDOC_TMPDIR/assertion/failure_demo.py:165>:2: AssertionError ____________________ TestMoreErrors.test_complex_error _____________________ self = @@ -438,7 +440,7 @@ get on the terminal - we are working on that):: return 43 > somefunc(f(), g()) - failure_demo.py:176: + failure_demo.py:178: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ failure_demo.py:9: in somefunc otherfunc(x,y) @@ -460,7 +462,7 @@ get on the terminal - we are working on that):: > a,b = l E ValueError: not enough values to unpack (expected 2, got 0) - failure_demo.py:180: ValueError + failure_demo.py:182: ValueError ____________________ TestMoreErrors.test_z2_type_error _____________________ self = @@ -470,7 +472,7 @@ get on the terminal - we are working on that):: > a,b = l E TypeError: 'int' object is not iterable - failure_demo.py:184: TypeError + failure_demo.py:186: TypeError ______________________ TestMoreErrors.test_startswith ______________________ self = @@ -483,7 +485,7 @@ get on the terminal - we are working on that):: E + where False = ('456') E + where = '123'.startswith - failure_demo.py:189: AssertionError + failure_demo.py:191: AssertionError __________________ TestMoreErrors.test_startswith_nested ___________________ self = @@ -500,7 +502,7 @@ get on the terminal - we are working on that):: E + where '123' = .f at 0xdeadbeef>() E + and '456' = .g at 0xdeadbeef>() - failure_demo.py:196: AssertionError + failure_demo.py:198: AssertionError _____________________ TestMoreErrors.test_global_func ______________________ self = @@ -511,7 +513,7 @@ get on the terminal - we are working on that):: E + where False = isinstance(43, float) E + where 43 = globf(42) - failure_demo.py:199: AssertionError + failure_demo.py:201: AssertionError _______________________ TestMoreErrors.test_instance _______________________ self = @@ -522,7 +524,7 @@ get on the terminal - we are working on that):: E assert 42 != 42 E + where 42 = .x - failure_demo.py:203: AssertionError + failure_demo.py:205: AssertionError _______________________ TestMoreErrors.test_compare ________________________ self = @@ -532,7 +534,7 @@ get on the terminal - we are working on that):: E assert 11 < 5 E + where 11 = globf(10) - failure_demo.py:206: AssertionError + failure_demo.py:208: AssertionError _____________________ TestMoreErrors.test_try_finally ______________________ self = @@ -543,7 +545,7 @@ get on the terminal - we are working on that):: > assert x == 0 E assert 1 == 0 - failure_demo.py:211: AssertionError + failure_demo.py:213: AssertionError ___________________ TestCustomAssertMsg.test_single_line ___________________ self = @@ -557,7 +559,7 @@ get on the terminal - we are working on that):: E assert 1 == 2 E + where 1 = .A'>.a - failure_demo.py:222: AssertionError + failure_demo.py:224: AssertionError ____________________ TestCustomAssertMsg.test_multiline ____________________ self = @@ -574,7 +576,7 @@ get on the terminal - we are working on that):: E assert 1 == 2 E + where 1 = .A'>.a - failure_demo.py:228: AssertionError + failure_demo.py:230: AssertionError ___________________ TestCustomAssertMsg.test_custom_repr ___________________ self = @@ -594,7 +596,7 @@ get on the terminal - we are working on that):: E assert 1 == 2 E + where 1 = This is JSON\n{\n 'foo': 'bar'\n}.a - failure_demo.py:238: AssertionError + failure_demo.py:240: AssertionError ============================= warnings summary ============================= None Metafunc.addcall is deprecated and scheduled to be removed in pytest 4.0. diff --git a/doc/en/example/simple.rst b/doc/en/example/simple.rst index 5dbf0a519..ffc68b296 100644 --- a/doc/en/example/simple.rst +++ b/doc/en/example/simple.rst @@ -332,7 +332,7 @@ 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 - cachedir: .cache + cachedir: .pytest_cache info1: did you know that ... did you? rootdir: $REGENDOC_TMPDIR, inifile: @@ -385,9 +385,9 @@ Now we can profile which test functions execute the slowest:: test_some_are_slow.py ... [100%] ========================= slowest 3 test durations ========================= - 0.31s call test_some_are_slow.py::test_funcslow2 - 0.20s call test_some_are_slow.py::test_funcslow1 - 0.17s call test_some_are_slow.py::test_funcfast + 0.58s call test_some_are_slow.py::test_funcslow2 + 0.41s call test_some_are_slow.py::test_funcslow1 + 0.10s call test_some_are_slow.py::test_funcfast ========================= 3 passed in 0.12 seconds ========================= incremental testing - test steps @@ -537,7 +537,7 @@ We can run this:: file $REGENDOC_TMPDIR/b/test_error.py, line 1 def test_root(db): # no db here, will error out E fixture 'db' not found - > available fixtures: cache, capfd, capfdbinary, caplog, capsys, capsysbinary, doctest_namespace, monkeypatch, pytestconfig, record_xml_property, recwarn, tmpdir, tmpdir_factory + > available fixtures: cache, capfd, capfdbinary, caplog, capsys, capsysbinary, doctest_namespace, monkeypatch, pytestconfig, record_xml_attribute, record_xml_property, recwarn, tmpdir, tmpdir_factory > use 'pytest --fixtures [testpath]' for help on them. $REGENDOC_TMPDIR/b/test_error.py:1 @@ -731,7 +731,7 @@ and run it:: test_module.py Esetting up a test failed! test_module.py::test_setup_fails Fexecuting test failed test_module.py::test_call_fails - F [100%] + F ================================== ERRORS ================================== ____________________ ERROR at setup of test_setup_fails ____________________ diff --git a/doc/en/example/special.rst b/doc/en/example/special.rst index 4437e1cc3..1fc32f6c8 100644 --- a/doc/en/example/special.rst +++ b/doc/en/example/special.rst @@ -68,5 +68,5 @@ If you run this without output capturing:: .test_method1 called .test other .test_unit1 method called - . [100%] + . 4 passed in 0.12 seconds diff --git a/doc/en/fixture.rst b/doc/en/fixture.rst index 01a941ddf..0828bdcf8 100644 --- a/doc/en/fixture.rst +++ b/doc/en/fixture.rst @@ -286,7 +286,7 @@ tests. Let's execute it:: $ pytest -s -q --tb=no - FF [100%]teardown smtp + FFteardown smtp 2 failed in 0.12 seconds @@ -391,7 +391,7 @@ We use the ``request.module`` attribute to optionally obtain an again, nothing much has changed:: $ pytest -s -q --tb=no - FF [100%]finalizing (smtp.gmail.com) + FFfinalizing (smtp.gmail.com) 2 failed in 0.12 seconds @@ -612,7 +612,7 @@ 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 - cachedir: .cache + cachedir: .pytest_cache rootdir: $REGENDOC_TMPDIR, inifile: collecting ... collected 2 items @@ -681,40 +681,40 @@ 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 - cachedir: .cache + cachedir: .pytest_cache rootdir: $REGENDOC_TMPDIR, inifile: collecting ... collected 8 items test_module.py::test_0[1] SETUP otherarg 1 RUN test0 with otherarg 1 - PASSED [ 12%] TEARDOWN otherarg 1 + PASSED TEARDOWN otherarg 1 test_module.py::test_0[2] SETUP otherarg 2 RUN test0 with otherarg 2 - PASSED [ 25%] TEARDOWN otherarg 2 + PASSED TEARDOWN otherarg 2 test_module.py::test_1[mod1] SETUP modarg mod1 RUN test1 with modarg mod1 - PASSED [ 37%] + PASSED test_module.py::test_2[1-mod1] SETUP otherarg 1 RUN test2 with otherarg 1 and modarg mod1 - PASSED [ 50%] TEARDOWN otherarg 1 + PASSED TEARDOWN otherarg 1 test_module.py::test_2[2-mod1] SETUP otherarg 2 RUN test2 with otherarg 2 and modarg mod1 - PASSED [ 62%] TEARDOWN otherarg 2 + PASSED TEARDOWN otherarg 2 test_module.py::test_1[mod2] TEARDOWN modarg mod1 SETUP modarg mod2 RUN test1 with modarg mod2 - PASSED [ 75%] + PASSED test_module.py::test_2[1-mod2] SETUP otherarg 1 RUN test2 with otherarg 1 and modarg mod2 - PASSED [ 87%] TEARDOWN otherarg 1 + PASSED TEARDOWN otherarg 1 test_module.py::test_2[2-mod2] SETUP otherarg 2 RUN test2 with otherarg 2 and modarg mod2 - PASSED [100%] TEARDOWN otherarg 2 + PASSED TEARDOWN otherarg 2 TEARDOWN modarg mod2 diff --git a/doc/en/usage.rst b/doc/en/usage.rst index 417e50793..abd8bac2b 100644 --- a/doc/en/usage.rst +++ b/doc/en/usage.rst @@ -447,6 +447,7 @@ hook was invoked:: $ python myinvoke.py *** test run reporting finishing + .. note::