Merge remote-tracking branch 'upstream/master' into merge-master-into-features
This commit is contained in:
		
						commit
						3b7fbcd47f
					
				|  | @ -18,6 +18,44 @@ with advance notice in the **Deprecations** section of releases. | ||||||
| 
 | 
 | ||||||
| .. towncrier release notes start | .. towncrier release notes start | ||||||
| 
 | 
 | ||||||
|  | pytest 3.9.3 (2018-10-27) | ||||||
|  | ========================= | ||||||
|  | 
 | ||||||
|  | Bug Fixes | ||||||
|  | --------- | ||||||
|  | 
 | ||||||
|  | - `#4174 <https://github.com/pytest-dev/pytest/issues/4174>`_: Fix "ValueError: Plugin already registered" with conftest plugins via symlink. | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | - `#4181 <https://github.com/pytest-dev/pytest/issues/4181>`_: Handle race condition between creation and deletion of temporary folders. | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | - `#4221 <https://github.com/pytest-dev/pytest/issues/4221>`_: Fix bug where the warning summary at the end of the test session was not showing the test where the warning was originated. | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | - `#4243 <https://github.com/pytest-dev/pytest/issues/4243>`_: Fix regression when ``stacklevel`` for warnings was passed as positional argument on python2. | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | Improved Documentation | ||||||
|  | ---------------------- | ||||||
|  | 
 | ||||||
|  | - `#3851 <https://github.com/pytest-dev/pytest/issues/3851>`_: Add reference to ``empty_parameter_set_mark`` ini option in documentation of ``@pytest.mark.parametrize`` | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | Trivial/Internal Changes | ||||||
|  | ------------------------ | ||||||
|  | 
 | ||||||
|  | - `#4028 <https://github.com/pytest-dev/pytest/issues/4028>`_: Revert patching of ``sys.breakpointhook`` since it appears to do nothing. | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | - `#4233 <https://github.com/pytest-dev/pytest/issues/4233>`_: Apply an import sorter (``reorder-python-imports``) to the codebase. | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | - `#4248 <https://github.com/pytest-dev/pytest/issues/4248>`_: Remove use of unnecessary compat shim, six.binary_type | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| pytest 3.9.2 (2018-10-22) | pytest 3.9.2 (2018-10-22) | ||||||
| ========================= | ========================= | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1 +0,0 @@ | ||||||
| Add reference to ``empty_parameter_set_mark`` ini option in documentation of ``@pytest.mark.parametrize`` |  | ||||||
|  | @ -1 +0,0 @@ | ||||||
| Revert patching of ``sys.breakpointhook`` since it appears to do nothing. |  | ||||||
|  | @ -1 +0,0 @@ | ||||||
| Fix "ValueError: Plugin already registered" with conftest plugins via symlink. |  | ||||||
|  | @ -1 +0,0 @@ | ||||||
| Fix bug where the warning summary at the end of the test session was not showing the test where the warning was originated. |  | ||||||
|  | @ -1 +0,0 @@ | ||||||
| Apply an import sorter (``reorder-python-imports``) to the codebase. |  | ||||||
|  | @ -6,6 +6,7 @@ Release announcements | ||||||
|    :maxdepth: 2 |    :maxdepth: 2 | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  |    release-3.9.3 | ||||||
|    release-3.9.2 |    release-3.9.2 | ||||||
|    release-3.9.1 |    release-3.9.1 | ||||||
|    release-3.9.0 |    release-3.9.0 | ||||||
|  |  | ||||||
|  | @ -0,0 +1,24 @@ | ||||||
|  | pytest-3.9.3 | ||||||
|  | ======================================= | ||||||
|  | 
 | ||||||
|  | pytest 3.9.3 has just been released to PyPI. | ||||||
|  | 
 | ||||||
|  | This is a bug-fix release, being a drop-in replacement. To upgrade:: | ||||||
|  | 
 | ||||||
|  |   pip install --upgrade pytest | ||||||
|  | 
 | ||||||
|  | The full changelog is available at https://docs.pytest.org/en/latest/changelog.html. | ||||||
|  | 
 | ||||||
|  | Thanks to all who contributed to this release, among them: | ||||||
|  | 
 | ||||||
|  | * Andreas Profous | ||||||
|  | * Ankit Goel | ||||||
|  | * Anthony Sottile | ||||||
|  | * Bruno Oliveira | ||||||
|  | * Daniel Hahler | ||||||
|  | * Jon Dufresne | ||||||
|  | * Ronny Pfannschmidt | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | Happy testing, | ||||||
|  | The pytest Development Team | ||||||
|  | @ -75,7 +75,7 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a | ||||||
|     caplog |     caplog | ||||||
|         Access and control log capturing. |         Access and control log capturing. | ||||||
| 
 | 
 | ||||||
|         Captured logs are available through the following methods:: |         Captured logs are available through the following properties/methods:: | ||||||
| 
 | 
 | ||||||
|         * caplog.text            -> string containing formatted log output |         * caplog.text            -> string containing formatted log output | ||||||
|         * caplog.records         -> list of logging.LogRecord instances |         * caplog.records         -> list of logging.LogRecord instances | ||||||
|  |  | ||||||
|  | @ -413,7 +413,7 @@ Running it results in some skips if we don't have all the python interpreters in | ||||||
|    . $ pytest -rs -q multipython.py |    . $ pytest -rs -q multipython.py | ||||||
|    ...sss...sssssssss...sss...                                          [100%] |    ...sss...sssssssss...sss...                                          [100%] | ||||||
|    ========================= short test summary info ========================== |    ========================= short test summary info ========================== | ||||||
|    SKIP [15] $REGENDOC_TMPDIR/CWD/multipython.py:29: 'python3.4' not found |    SKIP [15] $REGENDOC_TMPDIR/CWD/multipython.py:30: 'python3.4' not found | ||||||
|    12 passed, 15 skipped in 0.12 seconds |    12 passed, 15 skipped in 0.12 seconds | ||||||
| 
 | 
 | ||||||
| Indirect parametrization of optional implementations/imports | Indirect parametrization of optional implementations/imports | ||||||
|  |  | ||||||
|  | @ -26,7 +26,7 @@ get on the terminal - we are working on that):: | ||||||
|     >       assert param1 * 2 < param2 |     >       assert param1 * 2 < param2 | ||||||
|     E       assert (3 * 2) < 6 |     E       assert (3 * 2) < 6 | ||||||
| 
 | 
 | ||||||
|     failure_demo.py:19: AssertionError |     failure_demo.py:20: AssertionError | ||||||
|     _________________________ TestFailing.test_simple __________________________ |     _________________________ TestFailing.test_simple __________________________ | ||||||
| 
 | 
 | ||||||
|     self = <failure_demo.TestFailing object at 0xdeadbeef> |     self = <failure_demo.TestFailing object at 0xdeadbeef> | ||||||
|  | @ -43,7 +43,7 @@ get on the terminal - we are working on that):: | ||||||
|     E        +  where 42 = <function TestFailing.test_simple.<locals>.f at 0xdeadbeef>() |     E        +  where 42 = <function TestFailing.test_simple.<locals>.f at 0xdeadbeef>() | ||||||
|     E        +  and   43 = <function TestFailing.test_simple.<locals>.g at 0xdeadbeef>() |     E        +  and   43 = <function TestFailing.test_simple.<locals>.g at 0xdeadbeef>() | ||||||
| 
 | 
 | ||||||
|     failure_demo.py:35: AssertionError |     failure_demo.py:36: AssertionError | ||||||
|     ____________________ TestFailing.test_simple_multiline _____________________ |     ____________________ TestFailing.test_simple_multiline _____________________ | ||||||
| 
 | 
 | ||||||
|     self = <failure_demo.TestFailing object at 0xdeadbeef> |     self = <failure_demo.TestFailing object at 0xdeadbeef> | ||||||
|  | @ -51,7 +51,7 @@ get on the terminal - we are working on that):: | ||||||
|         def test_simple_multiline(self): |         def test_simple_multiline(self): | ||||||
|     >       otherfunc_multi(42, 6 * 9) |     >       otherfunc_multi(42, 6 * 9) | ||||||
| 
 | 
 | ||||||
|     failure_demo.py:38: |     failure_demo.py:39: | ||||||
|     _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |     _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | ||||||
| 
 | 
 | ||||||
|     a = 42, b = 54 |     a = 42, b = 54 | ||||||
|  | @ -60,7 +60,7 @@ get on the terminal - we are working on that):: | ||||||
|     >       assert a == b |     >       assert a == b | ||||||
|     E       assert 42 == 54 |     E       assert 42 == 54 | ||||||
| 
 | 
 | ||||||
|     failure_demo.py:15: AssertionError |     failure_demo.py:16: AssertionError | ||||||
|     ___________________________ TestFailing.test_not ___________________________ |     ___________________________ TestFailing.test_not ___________________________ | ||||||
| 
 | 
 | ||||||
|     self = <failure_demo.TestFailing object at 0xdeadbeef> |     self = <failure_demo.TestFailing object at 0xdeadbeef> | ||||||
|  | @ -73,7 +73,7 @@ get on the terminal - we are working on that):: | ||||||
|     E       assert not 42 |     E       assert not 42 | ||||||
|     E        +  where 42 = <function TestFailing.test_not.<locals>.f at 0xdeadbeef>() |     E        +  where 42 = <function TestFailing.test_not.<locals>.f at 0xdeadbeef>() | ||||||
| 
 | 
 | ||||||
|     failure_demo.py:44: AssertionError |     failure_demo.py:45: AssertionError | ||||||
|     _________________ TestSpecialisedExplanations.test_eq_text _________________ |     _________________ TestSpecialisedExplanations.test_eq_text _________________ | ||||||
| 
 | 
 | ||||||
|     self = <failure_demo.TestSpecialisedExplanations object at 0xdeadbeef> |     self = <failure_demo.TestSpecialisedExplanations object at 0xdeadbeef> | ||||||
|  | @ -84,7 +84,7 @@ get on the terminal - we are working on that):: | ||||||
|     E         - spam |     E         - spam | ||||||
|     E         + eggs |     E         + eggs | ||||||
| 
 | 
 | ||||||
|     failure_demo.py:49: AssertionError |     failure_demo.py:50: AssertionError | ||||||
|     _____________ TestSpecialisedExplanations.test_eq_similar_text _____________ |     _____________ TestSpecialisedExplanations.test_eq_similar_text _____________ | ||||||
| 
 | 
 | ||||||
|     self = <failure_demo.TestSpecialisedExplanations object at 0xdeadbeef> |     self = <failure_demo.TestSpecialisedExplanations object at 0xdeadbeef> | ||||||
|  | @ -97,7 +97,7 @@ get on the terminal - we are working on that):: | ||||||
|     E         + foo 2 bar |     E         + foo 2 bar | ||||||
|     E         ?     ^ |     E         ?     ^ | ||||||
| 
 | 
 | ||||||
|     failure_demo.py:52: AssertionError |     failure_demo.py:53: AssertionError | ||||||
|     ____________ TestSpecialisedExplanations.test_eq_multiline_text ____________ |     ____________ TestSpecialisedExplanations.test_eq_multiline_text ____________ | ||||||
| 
 | 
 | ||||||
|     self = <failure_demo.TestSpecialisedExplanations object at 0xdeadbeef> |     self = <failure_demo.TestSpecialisedExplanations object at 0xdeadbeef> | ||||||
|  | @ -110,7 +110,7 @@ get on the terminal - we are working on that):: | ||||||
|     E         + eggs |     E         + eggs | ||||||
|     E           bar |     E           bar | ||||||
| 
 | 
 | ||||||
|     failure_demo.py:55: AssertionError |     failure_demo.py:56: AssertionError | ||||||
|     ______________ TestSpecialisedExplanations.test_eq_long_text _______________ |     ______________ TestSpecialisedExplanations.test_eq_long_text _______________ | ||||||
| 
 | 
 | ||||||
|     self = <failure_demo.TestSpecialisedExplanations object at 0xdeadbeef> |     self = <failure_demo.TestSpecialisedExplanations object at 0xdeadbeef> | ||||||
|  | @ -127,7 +127,7 @@ get on the terminal - we are working on that):: | ||||||
|     E         + 1111111111b222222222 |     E         + 1111111111b222222222 | ||||||
|     E         ?           ^ |     E         ?           ^ | ||||||
| 
 | 
 | ||||||
|     failure_demo.py:60: AssertionError |     failure_demo.py:61: AssertionError | ||||||
|     _________ TestSpecialisedExplanations.test_eq_long_text_multiline __________ |     _________ TestSpecialisedExplanations.test_eq_long_text_multiline __________ | ||||||
| 
 | 
 | ||||||
|     self = <failure_demo.TestSpecialisedExplanations object at 0xdeadbeef> |     self = <failure_demo.TestSpecialisedExplanations object at 0xdeadbeef> | ||||||
|  | @ -147,7 +147,7 @@ get on the terminal - we are working on that):: | ||||||
|     E |     E | ||||||
|     E         ...Full output truncated (7 lines hidden), use '-vv' to show |     E         ...Full output truncated (7 lines hidden), use '-vv' to show | ||||||
| 
 | 
 | ||||||
|     failure_demo.py:65: AssertionError |     failure_demo.py:66: AssertionError | ||||||
|     _________________ TestSpecialisedExplanations.test_eq_list _________________ |     _________________ TestSpecialisedExplanations.test_eq_list _________________ | ||||||
| 
 | 
 | ||||||
|     self = <failure_demo.TestSpecialisedExplanations object at 0xdeadbeef> |     self = <failure_demo.TestSpecialisedExplanations object at 0xdeadbeef> | ||||||
|  | @ -158,7 +158,7 @@ get on the terminal - we are working on that):: | ||||||
|     E         At index 2 diff: 2 != 3 |     E         At index 2 diff: 2 != 3 | ||||||
|     E         Use -v to get the full diff |     E         Use -v to get the full diff | ||||||
| 
 | 
 | ||||||
|     failure_demo.py:68: AssertionError |     failure_demo.py:69: AssertionError | ||||||
|     ______________ TestSpecialisedExplanations.test_eq_list_long _______________ |     ______________ TestSpecialisedExplanations.test_eq_list_long _______________ | ||||||
| 
 | 
 | ||||||
|     self = <failure_demo.TestSpecialisedExplanations object at 0xdeadbeef> |     self = <failure_demo.TestSpecialisedExplanations object at 0xdeadbeef> | ||||||
|  | @ -171,7 +171,7 @@ get on the terminal - we are working on that):: | ||||||
|     E         At index 100 diff: 1 != 2 |     E         At index 100 diff: 1 != 2 | ||||||
|     E         Use -v to get the full diff |     E         Use -v to get the full diff | ||||||
| 
 | 
 | ||||||
|     failure_demo.py:73: AssertionError |     failure_demo.py:74: AssertionError | ||||||
|     _________________ TestSpecialisedExplanations.test_eq_dict _________________ |     _________________ TestSpecialisedExplanations.test_eq_dict _________________ | ||||||
| 
 | 
 | ||||||
|     self = <failure_demo.TestSpecialisedExplanations object at 0xdeadbeef> |     self = <failure_demo.TestSpecialisedExplanations object at 0xdeadbeef> | ||||||
|  | @ -189,7 +189,7 @@ get on the terminal - we are working on that):: | ||||||
|     E |     E | ||||||
|     E         ...Full output truncated (2 lines hidden), use '-vv' to show |     E         ...Full output truncated (2 lines hidden), use '-vv' to show | ||||||
| 
 | 
 | ||||||
|     failure_demo.py:76: AssertionError |     failure_demo.py:77: AssertionError | ||||||
|     _________________ TestSpecialisedExplanations.test_eq_set __________________ |     _________________ TestSpecialisedExplanations.test_eq_set __________________ | ||||||
| 
 | 
 | ||||||
|     self = <failure_demo.TestSpecialisedExplanations object at 0xdeadbeef> |     self = <failure_demo.TestSpecialisedExplanations object at 0xdeadbeef> | ||||||
|  | @ -207,7 +207,7 @@ get on the terminal - we are working on that):: | ||||||
|     E |     E | ||||||
|     E         ...Full output truncated (2 lines hidden), use '-vv' to show |     E         ...Full output truncated (2 lines hidden), use '-vv' to show | ||||||
| 
 | 
 | ||||||
|     failure_demo.py:79: AssertionError |     failure_demo.py:80: AssertionError | ||||||
|     _____________ TestSpecialisedExplanations.test_eq_longer_list ______________ |     _____________ TestSpecialisedExplanations.test_eq_longer_list ______________ | ||||||
| 
 | 
 | ||||||
|     self = <failure_demo.TestSpecialisedExplanations object at 0xdeadbeef> |     self = <failure_demo.TestSpecialisedExplanations object at 0xdeadbeef> | ||||||
|  | @ -218,7 +218,7 @@ get on the terminal - we are working on that):: | ||||||
|     E         Right contains more items, first extra item: 3 |     E         Right contains more items, first extra item: 3 | ||||||
|     E         Use -v to get the full diff |     E         Use -v to get the full diff | ||||||
| 
 | 
 | ||||||
|     failure_demo.py:82: AssertionError |     failure_demo.py:83: AssertionError | ||||||
|     _________________ TestSpecialisedExplanations.test_in_list _________________ |     _________________ TestSpecialisedExplanations.test_in_list _________________ | ||||||
| 
 | 
 | ||||||
|     self = <failure_demo.TestSpecialisedExplanations object at 0xdeadbeef> |     self = <failure_demo.TestSpecialisedExplanations object at 0xdeadbeef> | ||||||
|  | @ -227,7 +227,7 @@ get on the terminal - we are working on that):: | ||||||
|     >       assert 1 in [0, 2, 3, 4, 5] |     >       assert 1 in [0, 2, 3, 4, 5] | ||||||
|     E       assert 1 in [0, 2, 3, 4, 5] |     E       assert 1 in [0, 2, 3, 4, 5] | ||||||
| 
 | 
 | ||||||
|     failure_demo.py:85: AssertionError |     failure_demo.py:86: AssertionError | ||||||
|     __________ TestSpecialisedExplanations.test_not_in_text_multiline __________ |     __________ TestSpecialisedExplanations.test_not_in_text_multiline __________ | ||||||
| 
 | 
 | ||||||
|     self = <failure_demo.TestSpecialisedExplanations object at 0xdeadbeef> |     self = <failure_demo.TestSpecialisedExplanations object at 0xdeadbeef> | ||||||
|  | @ -246,7 +246,7 @@ get on the terminal - we are working on that):: | ||||||
|     E |     E | ||||||
|     E         ...Full output truncated (2 lines hidden), use '-vv' to show |     E         ...Full output truncated (2 lines hidden), use '-vv' to show | ||||||
| 
 | 
 | ||||||
|     failure_demo.py:89: AssertionError |     failure_demo.py:90: AssertionError | ||||||
|     ___________ TestSpecialisedExplanations.test_not_in_text_single ____________ |     ___________ TestSpecialisedExplanations.test_not_in_text_single ____________ | ||||||
| 
 | 
 | ||||||
|     self = <failure_demo.TestSpecialisedExplanations object at 0xdeadbeef> |     self = <failure_demo.TestSpecialisedExplanations object at 0xdeadbeef> | ||||||
|  | @ -259,7 +259,7 @@ get on the terminal - we are working on that):: | ||||||
|     E           single foo line |     E           single foo line | ||||||
|     E         ?        +++ |     E         ?        +++ | ||||||
| 
 | 
 | ||||||
|     failure_demo.py:93: AssertionError |     failure_demo.py:94: AssertionError | ||||||
|     _________ TestSpecialisedExplanations.test_not_in_text_single_long _________ |     _________ TestSpecialisedExplanations.test_not_in_text_single_long _________ | ||||||
| 
 | 
 | ||||||
|     self = <failure_demo.TestSpecialisedExplanations object at 0xdeadbeef> |     self = <failure_demo.TestSpecialisedExplanations object at 0xdeadbeef> | ||||||
|  | @ -272,7 +272,7 @@ get on the terminal - we are working on that):: | ||||||
|     E           head head foo tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail |     E           head head foo tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail | ||||||
|     E         ?           +++ |     E         ?           +++ | ||||||
| 
 | 
 | ||||||
|     failure_demo.py:97: AssertionError |     failure_demo.py:98: AssertionError | ||||||
|     ______ TestSpecialisedExplanations.test_not_in_text_single_long_term _______ |     ______ TestSpecialisedExplanations.test_not_in_text_single_long_term _______ | ||||||
| 
 | 
 | ||||||
|     self = <failure_demo.TestSpecialisedExplanations object at 0xdeadbeef> |     self = <failure_demo.TestSpecialisedExplanations object at 0xdeadbeef> | ||||||
|  | @ -285,7 +285,7 @@ get on the terminal - we are working on that):: | ||||||
|     E           head head fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffftail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail |     E           head head fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffftail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail | ||||||
|     E         ?           ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |     E         ?           ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||||||
| 
 | 
 | ||||||
|     failure_demo.py:101: AssertionError |     failure_demo.py:102: AssertionError | ||||||
|     ______________________________ test_attribute ______________________________ |     ______________________________ test_attribute ______________________________ | ||||||
| 
 | 
 | ||||||
|         def test_attribute(): |         def test_attribute(): | ||||||
|  | @ -297,7 +297,7 @@ get on the terminal - we are working on that):: | ||||||
|     E       assert 1 == 2 |     E       assert 1 == 2 | ||||||
|     E        +  where 1 = <failure_demo.test_attribute.<locals>.Foo object at 0xdeadbeef>.b |     E        +  where 1 = <failure_demo.test_attribute.<locals>.Foo object at 0xdeadbeef>.b | ||||||
| 
 | 
 | ||||||
|     failure_demo.py:109: AssertionError |     failure_demo.py:110: AssertionError | ||||||
|     _________________________ test_attribute_instance __________________________ |     _________________________ test_attribute_instance __________________________ | ||||||
| 
 | 
 | ||||||
|         def test_attribute_instance(): |         def test_attribute_instance(): | ||||||
|  | @ -309,7 +309,7 @@ get on the terminal - we are working on that):: | ||||||
|     E        +  where 1 = <failure_demo.test_attribute_instance.<locals>.Foo object at 0xdeadbeef>.b |     E        +  where 1 = <failure_demo.test_attribute_instance.<locals>.Foo object at 0xdeadbeef>.b | ||||||
|     E        +    where <failure_demo.test_attribute_instance.<locals>.Foo object at 0xdeadbeef> = <class 'failure_demo.test_attribute_instance.<locals>.Foo'>() |     E        +    where <failure_demo.test_attribute_instance.<locals>.Foo object at 0xdeadbeef> = <class 'failure_demo.test_attribute_instance.<locals>.Foo'>() | ||||||
| 
 | 
 | ||||||
|     failure_demo.py:116: AssertionError |     failure_demo.py:117: AssertionError | ||||||
|     __________________________ test_attribute_failure __________________________ |     __________________________ test_attribute_failure __________________________ | ||||||
| 
 | 
 | ||||||
|         def test_attribute_failure(): |         def test_attribute_failure(): | ||||||
|  | @ -322,7 +322,7 @@ get on the terminal - we are working on that):: | ||||||
|             i = Foo() |             i = Foo() | ||||||
|     >       assert i.b == 2 |     >       assert i.b == 2 | ||||||
| 
 | 
 | ||||||
|     failure_demo.py:127: |     failure_demo.py:128: | ||||||
|     _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |     _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | ||||||
| 
 | 
 | ||||||
|     self = <failure_demo.test_attribute_failure.<locals>.Foo object at 0xdeadbeef> |     self = <failure_demo.test_attribute_failure.<locals>.Foo object at 0xdeadbeef> | ||||||
|  | @ -331,7 +331,7 @@ get on the terminal - we are working on that):: | ||||||
|     >       raise Exception("Failed to get attrib") |     >       raise Exception("Failed to get attrib") | ||||||
|     E       Exception: Failed to get attrib |     E       Exception: Failed to get attrib | ||||||
| 
 | 
 | ||||||
|     failure_demo.py:122: Exception |     failure_demo.py:123: Exception | ||||||
|     _________________________ test_attribute_multiple __________________________ |     _________________________ test_attribute_multiple __________________________ | ||||||
| 
 | 
 | ||||||
|         def test_attribute_multiple(): |         def test_attribute_multiple(): | ||||||
|  | @ -348,7 +348,7 @@ get on the terminal - we are working on that):: | ||||||
|     E        +  and   2 = <failure_demo.test_attribute_multiple.<locals>.Bar object at 0xdeadbeef>.b |     E        +  and   2 = <failure_demo.test_attribute_multiple.<locals>.Bar object at 0xdeadbeef>.b | ||||||
|     E        +    where <failure_demo.test_attribute_multiple.<locals>.Bar object at 0xdeadbeef> = <class 'failure_demo.test_attribute_multiple.<locals>.Bar'>() |     E        +    where <failure_demo.test_attribute_multiple.<locals>.Bar object at 0xdeadbeef> = <class 'failure_demo.test_attribute_multiple.<locals>.Bar'>() | ||||||
| 
 | 
 | ||||||
|     failure_demo.py:137: AssertionError |     failure_demo.py:138: AssertionError | ||||||
|     __________________________ TestRaises.test_raises __________________________ |     __________________________ TestRaises.test_raises __________________________ | ||||||
| 
 | 
 | ||||||
|     self = <failure_demo.TestRaises object at 0xdeadbeef> |     self = <failure_demo.TestRaises object at 0xdeadbeef> | ||||||
|  | @ -357,7 +357,7 @@ get on the terminal - we are working on that):: | ||||||
|             s = "qwe"  # NOQA |             s = "qwe"  # NOQA | ||||||
|     >       raises(TypeError, "int(s)") |     >       raises(TypeError, "int(s)") | ||||||
| 
 | 
 | ||||||
|     failure_demo.py:147: |     failure_demo.py:148: | ||||||
|     _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |     _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | ||||||
| 
 | 
 | ||||||
|     >   int(s) |     >   int(s) | ||||||
|  | @ -372,7 +372,7 @@ get on the terminal - we are working on that):: | ||||||
|     >       raises(IOError, "int('3')") |     >       raises(IOError, "int('3')") | ||||||
|     E       Failed: DID NOT RAISE <class 'OSError'> |     E       Failed: DID NOT RAISE <class 'OSError'> | ||||||
| 
 | 
 | ||||||
|     failure_demo.py:150: Failed |     failure_demo.py:151: Failed | ||||||
|     __________________________ TestRaises.test_raise ___________________________ |     __________________________ TestRaises.test_raise ___________________________ | ||||||
| 
 | 
 | ||||||
|     self = <failure_demo.TestRaises object at 0xdeadbeef> |     self = <failure_demo.TestRaises object at 0xdeadbeef> | ||||||
|  | @ -381,7 +381,7 @@ get on the terminal - we are working on that):: | ||||||
|     >       raise ValueError("demo error") |     >       raise ValueError("demo error") | ||||||
|     E       ValueError: demo error |     E       ValueError: demo error | ||||||
| 
 | 
 | ||||||
|     failure_demo.py:153: ValueError |     failure_demo.py:154: ValueError | ||||||
|     ________________________ TestRaises.test_tupleerror ________________________ |     ________________________ TestRaises.test_tupleerror ________________________ | ||||||
| 
 | 
 | ||||||
|     self = <failure_demo.TestRaises object at 0xdeadbeef> |     self = <failure_demo.TestRaises object at 0xdeadbeef> | ||||||
|  | @ -390,7 +390,7 @@ get on the terminal - we are working on that):: | ||||||
|     >       a, b = [1]  # NOQA |     >       a, b = [1]  # NOQA | ||||||
|     E       ValueError: not enough values to unpack (expected 2, got 1) |     E       ValueError: not enough values to unpack (expected 2, got 1) | ||||||
| 
 | 
 | ||||||
|     failure_demo.py:156: ValueError |     failure_demo.py:157: ValueError | ||||||
|     ______ TestRaises.test_reinterpret_fails_with_print_for_the_fun_of_it ______ |     ______ TestRaises.test_reinterpret_fails_with_print_for_the_fun_of_it ______ | ||||||
| 
 | 
 | ||||||
|     self = <failure_demo.TestRaises object at 0xdeadbeef> |     self = <failure_demo.TestRaises object at 0xdeadbeef> | ||||||
|  | @ -401,7 +401,7 @@ get on the terminal - we are working on that):: | ||||||
|     >       a, b = items.pop() |     >       a, b = items.pop() | ||||||
|     E       TypeError: 'int' object is not iterable |     E       TypeError: 'int' object is not iterable | ||||||
| 
 | 
 | ||||||
|     failure_demo.py:161: TypeError |     failure_demo.py:162: TypeError | ||||||
|     --------------------------- Captured stdout call --------------------------- |     --------------------------- Captured stdout call --------------------------- | ||||||
|     items is [1, 2, 3] |     items is [1, 2, 3] | ||||||
|     ________________________ TestRaises.test_some_error ________________________ |     ________________________ TestRaises.test_some_error ________________________ | ||||||
|  | @ -412,7 +412,7 @@ get on the terminal - we are working on that):: | ||||||
|     >       if namenotexi:  # NOQA |     >       if namenotexi:  # NOQA | ||||||
|     E       NameError: name 'namenotexi' is not defined |     E       NameError: name 'namenotexi' is not defined | ||||||
| 
 | 
 | ||||||
|     failure_demo.py:164: NameError |     failure_demo.py:165: NameError | ||||||
|     ____________________ test_dynamic_compile_shows_nicely _____________________ |     ____________________ test_dynamic_compile_shows_nicely _____________________ | ||||||
| 
 | 
 | ||||||
|         def test_dynamic_compile_shows_nicely(): |         def test_dynamic_compile_shows_nicely(): | ||||||
|  | @ -427,14 +427,14 @@ get on the terminal - we are working on that):: | ||||||
|             sys.modules[name] = module |             sys.modules[name] = module | ||||||
|     >       module.foo() |     >       module.foo() | ||||||
| 
 | 
 | ||||||
|     failure_demo.py:182: |     failure_demo.py:183: | ||||||
|     _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |     _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | ||||||
| 
 | 
 | ||||||
|         def foo(): |         def foo(): | ||||||
|     >    assert 1 == 0 |     >    assert 1 == 0 | ||||||
|     E    AssertionError |     E    AssertionError | ||||||
| 
 | 
 | ||||||
|     <2-codegen 'abc-123' $REGENDOC_TMPDIR/assertion/failure_demo.py:179>:2: AssertionError |     <2-codegen 'abc-123' $REGENDOC_TMPDIR/assertion/failure_demo.py:180>:2: AssertionError | ||||||
|     ____________________ TestMoreErrors.test_complex_error _____________________ |     ____________________ TestMoreErrors.test_complex_error _____________________ | ||||||
| 
 | 
 | ||||||
|     self = <failure_demo.TestMoreErrors object at 0xdeadbeef> |     self = <failure_demo.TestMoreErrors object at 0xdeadbeef> | ||||||
|  | @ -448,9 +448,9 @@ get on the terminal - we are working on that):: | ||||||
| 
 | 
 | ||||||
|     >       somefunc(f(), g()) |     >       somefunc(f(), g()) | ||||||
| 
 | 
 | ||||||
|     failure_demo.py:193: |     failure_demo.py:194: | ||||||
|     _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |     _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | ||||||
|     failure_demo.py:11: in somefunc |     failure_demo.py:12: in somefunc | ||||||
|         otherfunc(x, y) |         otherfunc(x, y) | ||||||
|     _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |     _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | ||||||
| 
 | 
 | ||||||
|  | @ -460,7 +460,7 @@ get on the terminal - we are working on that):: | ||||||
|     >       assert a == b |     >       assert a == b | ||||||
|     E       assert 44 == 43 |     E       assert 44 == 43 | ||||||
| 
 | 
 | ||||||
|     failure_demo.py:7: AssertionError |     failure_demo.py:8: AssertionError | ||||||
|     ___________________ TestMoreErrors.test_z1_unpack_error ____________________ |     ___________________ TestMoreErrors.test_z1_unpack_error ____________________ | ||||||
| 
 | 
 | ||||||
|     self = <failure_demo.TestMoreErrors object at 0xdeadbeef> |     self = <failure_demo.TestMoreErrors object at 0xdeadbeef> | ||||||
|  | @ -470,7 +470,7 @@ get on the terminal - we are working on that):: | ||||||
|     >       a, b = items |     >       a, b = items | ||||||
|     E       ValueError: not enough values to unpack (expected 2, got 0) |     E       ValueError: not enough values to unpack (expected 2, got 0) | ||||||
| 
 | 
 | ||||||
|     failure_demo.py:197: ValueError |     failure_demo.py:198: ValueError | ||||||
|     ____________________ TestMoreErrors.test_z2_type_error _____________________ |     ____________________ TestMoreErrors.test_z2_type_error _____________________ | ||||||
| 
 | 
 | ||||||
|     self = <failure_demo.TestMoreErrors object at 0xdeadbeef> |     self = <failure_demo.TestMoreErrors object at 0xdeadbeef> | ||||||
|  | @ -480,7 +480,7 @@ get on the terminal - we are working on that):: | ||||||
|     >       a, b = items |     >       a, b = items | ||||||
|     E       TypeError: 'int' object is not iterable |     E       TypeError: 'int' object is not iterable | ||||||
| 
 | 
 | ||||||
|     failure_demo.py:201: TypeError |     failure_demo.py:202: TypeError | ||||||
|     ______________________ TestMoreErrors.test_startswith ______________________ |     ______________________ TestMoreErrors.test_startswith ______________________ | ||||||
| 
 | 
 | ||||||
|     self = <failure_demo.TestMoreErrors object at 0xdeadbeef> |     self = <failure_demo.TestMoreErrors object at 0xdeadbeef> | ||||||
|  | @ -493,7 +493,7 @@ get on the terminal - we are working on that):: | ||||||
|     E        +  where False = <built-in method startswith of str object at 0xdeadbeef>('456') |     E        +  where False = <built-in method startswith of str object at 0xdeadbeef>('456') | ||||||
|     E        +    where <built-in method startswith of str object at 0xdeadbeef> = '123'.startswith |     E        +    where <built-in method startswith of str object at 0xdeadbeef> = '123'.startswith | ||||||
| 
 | 
 | ||||||
|     failure_demo.py:206: AssertionError |     failure_demo.py:207: AssertionError | ||||||
|     __________________ TestMoreErrors.test_startswith_nested ___________________ |     __________________ TestMoreErrors.test_startswith_nested ___________________ | ||||||
| 
 | 
 | ||||||
|     self = <failure_demo.TestMoreErrors object at 0xdeadbeef> |     self = <failure_demo.TestMoreErrors object at 0xdeadbeef> | ||||||
|  | @ -512,7 +512,7 @@ get on the terminal - we are working on that):: | ||||||
|     E        +      where '123' = <function TestMoreErrors.test_startswith_nested.<locals>.f at 0xdeadbeef>() |     E        +      where '123' = <function TestMoreErrors.test_startswith_nested.<locals>.f at 0xdeadbeef>() | ||||||
|     E        +    and   '456' = <function TestMoreErrors.test_startswith_nested.<locals>.g at 0xdeadbeef>() |     E        +    and   '456' = <function TestMoreErrors.test_startswith_nested.<locals>.g at 0xdeadbeef>() | ||||||
| 
 | 
 | ||||||
|     failure_demo.py:215: AssertionError |     failure_demo.py:216: AssertionError | ||||||
|     _____________________ TestMoreErrors.test_global_func ______________________ |     _____________________ TestMoreErrors.test_global_func ______________________ | ||||||
| 
 | 
 | ||||||
|     self = <failure_demo.TestMoreErrors object at 0xdeadbeef> |     self = <failure_demo.TestMoreErrors object at 0xdeadbeef> | ||||||
|  | @ -523,7 +523,7 @@ get on the terminal - we are working on that):: | ||||||
|     E        +  where False = isinstance(43, float) |     E        +  where False = isinstance(43, float) | ||||||
|     E        +    where 43 = globf(42) |     E        +    where 43 = globf(42) | ||||||
| 
 | 
 | ||||||
|     failure_demo.py:218: AssertionError |     failure_demo.py:219: AssertionError | ||||||
|     _______________________ TestMoreErrors.test_instance _______________________ |     _______________________ TestMoreErrors.test_instance _______________________ | ||||||
| 
 | 
 | ||||||
|     self = <failure_demo.TestMoreErrors object at 0xdeadbeef> |     self = <failure_demo.TestMoreErrors object at 0xdeadbeef> | ||||||
|  | @ -534,7 +534,7 @@ get on the terminal - we are working on that):: | ||||||
|     E       assert 42 != 42 |     E       assert 42 != 42 | ||||||
|     E        +  where 42 = <failure_demo.TestMoreErrors object at 0xdeadbeef>.x |     E        +  where 42 = <failure_demo.TestMoreErrors object at 0xdeadbeef>.x | ||||||
| 
 | 
 | ||||||
|     failure_demo.py:222: AssertionError |     failure_demo.py:223: AssertionError | ||||||
|     _______________________ TestMoreErrors.test_compare ________________________ |     _______________________ TestMoreErrors.test_compare ________________________ | ||||||
| 
 | 
 | ||||||
|     self = <failure_demo.TestMoreErrors object at 0xdeadbeef> |     self = <failure_demo.TestMoreErrors object at 0xdeadbeef> | ||||||
|  | @ -544,7 +544,7 @@ get on the terminal - we are working on that):: | ||||||
|     E       assert 11 < 5 |     E       assert 11 < 5 | ||||||
|     E        +  where 11 = globf(10) |     E        +  where 11 = globf(10) | ||||||
| 
 | 
 | ||||||
|     failure_demo.py:225: AssertionError |     failure_demo.py:226: AssertionError | ||||||
|     _____________________ TestMoreErrors.test_try_finally ______________________ |     _____________________ TestMoreErrors.test_try_finally ______________________ | ||||||
| 
 | 
 | ||||||
|     self = <failure_demo.TestMoreErrors object at 0xdeadbeef> |     self = <failure_demo.TestMoreErrors object at 0xdeadbeef> | ||||||
|  | @ -555,7 +555,7 @@ get on the terminal - we are working on that):: | ||||||
|     >           assert x == 0 |     >           assert x == 0 | ||||||
|     E           assert 1 == 0 |     E           assert 1 == 0 | ||||||
| 
 | 
 | ||||||
|     failure_demo.py:230: AssertionError |     failure_demo.py:231: AssertionError | ||||||
|     ___________________ TestCustomAssertMsg.test_single_line ___________________ |     ___________________ TestCustomAssertMsg.test_single_line ___________________ | ||||||
| 
 | 
 | ||||||
|     self = <failure_demo.TestCustomAssertMsg object at 0xdeadbeef> |     self = <failure_demo.TestCustomAssertMsg object at 0xdeadbeef> | ||||||
|  | @ -570,7 +570,7 @@ get on the terminal - we are working on that):: | ||||||
|     E       assert 1 == 2 |     E       assert 1 == 2 | ||||||
|     E        +  where 1 = <class 'failure_demo.TestCustomAssertMsg.test_single_line.<locals>.A'>.a |     E        +  where 1 = <class 'failure_demo.TestCustomAssertMsg.test_single_line.<locals>.A'>.a | ||||||
| 
 | 
 | ||||||
|     failure_demo.py:241: AssertionError |     failure_demo.py:242: AssertionError | ||||||
|     ____________________ TestCustomAssertMsg.test_multiline ____________________ |     ____________________ TestCustomAssertMsg.test_multiline ____________________ | ||||||
| 
 | 
 | ||||||
|     self = <failure_demo.TestCustomAssertMsg object at 0xdeadbeef> |     self = <failure_demo.TestCustomAssertMsg object at 0xdeadbeef> | ||||||
|  | @ -589,7 +589,7 @@ get on the terminal - we are working on that):: | ||||||
|     E       assert 1 == 2 |     E       assert 1 == 2 | ||||||
|     E        +  where 1 = <class 'failure_demo.TestCustomAssertMsg.test_multiline.<locals>.A'>.a |     E        +  where 1 = <class 'failure_demo.TestCustomAssertMsg.test_multiline.<locals>.A'>.a | ||||||
| 
 | 
 | ||||||
|     failure_demo.py:248: AssertionError |     failure_demo.py:249: AssertionError | ||||||
|     ___________________ TestCustomAssertMsg.test_custom_repr ___________________ |     ___________________ TestCustomAssertMsg.test_custom_repr ___________________ | ||||||
| 
 | 
 | ||||||
|     self = <failure_demo.TestCustomAssertMsg object at 0xdeadbeef> |     self = <failure_demo.TestCustomAssertMsg object at 0xdeadbeef> | ||||||
|  | @ -611,9 +611,10 @@ get on the terminal - we are working on that):: | ||||||
|     E       assert 1 == 2 |     E       assert 1 == 2 | ||||||
|     E        +  where 1 = This is JSON\n{\n  'foo': 'bar'\n}.a |     E        +  where 1 = This is JSON\n{\n  'foo': 'bar'\n}.a | ||||||
| 
 | 
 | ||||||
|     failure_demo.py:261: AssertionError |     failure_demo.py:262: AssertionError | ||||||
|     ============================= warnings summary ============================= |     ============================= warnings summary ============================= | ||||||
|     $REGENDOC_TMPDIR/assertion/failure_demo.py:24: RemovedInPytest4Warning: Metafunc.addcall is deprecated and scheduled to be removed in pytest 4.0. |     failure_demo.py:25 | ||||||
|  |       $REGENDOC_TMPDIR/assertion/failure_demo.py:25: RemovedInPytest4Warning: Metafunc.addcall is deprecated and scheduled to be removed in pytest 4.0. | ||||||
|       Please use Metafunc.parametrize instead. |       Please use Metafunc.parametrize instead. | ||||||
|         metafunc.addcall(funcargs=dict(param1=3, param2=6)) |         metafunc.addcall(funcargs=dict(param1=3, param2=6)) | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -29,6 +29,7 @@ Running pytest now produces this output:: | ||||||
|     test_show_warnings.py .                                              [100%] |     test_show_warnings.py .                                              [100%] | ||||||
| 
 | 
 | ||||||
|     ============================= warnings summary ============================= |     ============================= warnings summary ============================= | ||||||
|  |     test_show_warnings.py::test_one | ||||||
|       $REGENDOC_TMPDIR/test_show_warnings.py:4: UserWarning: api v1, should use functions from v2 |       $REGENDOC_TMPDIR/test_show_warnings.py:4: UserWarning: api v1, should use functions from v2 | ||||||
|         warnings.warn(UserWarning("api v1, should use functions from v2")) |         warnings.warn(UserWarning("api v1, should use functions from v2")) | ||||||
| 
 | 
 | ||||||
|  | @ -351,6 +352,7 @@ defines an ``__init__`` constructor, as this prevents the class from being insta | ||||||
|     $ pytest test_pytest_warnings.py -q |     $ pytest test_pytest_warnings.py -q | ||||||
| 
 | 
 | ||||||
|     ============================= warnings summary ============================= |     ============================= warnings summary ============================= | ||||||
|  |     test_pytest_warnings.py:1 | ||||||
|       $REGENDOC_TMPDIR/test_pytest_warnings.py:1: PytestWarning: cannot collect test class 'Test' because it has a __init__ constructor |       $REGENDOC_TMPDIR/test_pytest_warnings.py:1: PytestWarning: cannot collect test class 'Test' because it has a __init__ constructor | ||||||
|         class Test: |         class Test: | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -418,19 +418,20 @@ additionally it is possible to copy examples for a example folder before running | ||||||
|     test_example.py ..                                                   [100%] |     test_example.py ..                                                   [100%] | ||||||
| 
 | 
 | ||||||
|     ============================= warnings summary ============================= |     ============================= warnings summary ============================= | ||||||
|  |     test_example.py::test_plugin | ||||||
|       $REGENDOC_TMPDIR/test_example.py:4: PytestExperimentalApiWarning: testdir.copy_example is an experimental api that may change over time |       $REGENDOC_TMPDIR/test_example.py:4: PytestExperimentalApiWarning: testdir.copy_example is an experimental api that may change over time | ||||||
|         testdir.copy_example("test_example.py") |         testdir.copy_example("test_example.py") | ||||||
|     $PYTHON_PREFIX/lib/python3.6/site-packages/_pytest/compat.py:329: RemovedInPytest4Warning: usage of Session.Class is deprecated, please use pytest.Class instead |       $PYTHON_PREFIX/lib/python3.6/site-packages/_pytest/compat.py:332: RemovedInPytest4Warning: usage of Session.Class is deprecated, please use pytest.Class instead | ||||||
|         return getattr(object, name, default) |         return getattr(object, name, default) | ||||||
|     $PYTHON_PREFIX/lib/python3.6/site-packages/_pytest/compat.py:329: RemovedInPytest4Warning: usage of Session.File is deprecated, please use pytest.File instead |       $PYTHON_PREFIX/lib/python3.6/site-packages/_pytest/compat.py:332: RemovedInPytest4Warning: usage of Session.File is deprecated, please use pytest.File instead | ||||||
|         return getattr(object, name, default) |         return getattr(object, name, default) | ||||||
|     $PYTHON_PREFIX/lib/python3.6/site-packages/_pytest/compat.py:329: RemovedInPytest4Warning: usage of Session.Function is deprecated, please use pytest.Function instead |       $PYTHON_PREFIX/lib/python3.6/site-packages/_pytest/compat.py:332: RemovedInPytest4Warning: usage of Session.Function is deprecated, please use pytest.Function instead | ||||||
|         return getattr(object, name, default) |         return getattr(object, name, default) | ||||||
|     $PYTHON_PREFIX/lib/python3.6/site-packages/_pytest/compat.py:329: RemovedInPytest4Warning: usage of Session.Instance is deprecated, please use pytest.Instance instead |       $PYTHON_PREFIX/lib/python3.6/site-packages/_pytest/compat.py:332: RemovedInPytest4Warning: usage of Session.Instance is deprecated, please use pytest.Instance instead | ||||||
|         return getattr(object, name, default) |         return getattr(object, name, default) | ||||||
|     $PYTHON_PREFIX/lib/python3.6/site-packages/_pytest/compat.py:329: RemovedInPytest4Warning: usage of Session.Item is deprecated, please use pytest.Item instead |       $PYTHON_PREFIX/lib/python3.6/site-packages/_pytest/compat.py:332: RemovedInPytest4Warning: usage of Session.Item is deprecated, please use pytest.Item instead | ||||||
|         return getattr(object, name, default) |         return getattr(object, name, default) | ||||||
|     $PYTHON_PREFIX/lib/python3.6/site-packages/_pytest/compat.py:329: RemovedInPytest4Warning: usage of Session.Module is deprecated, please use pytest.Module instead |       $PYTHON_PREFIX/lib/python3.6/site-packages/_pytest/compat.py:332: RemovedInPytest4Warning: usage of Session.Module is deprecated, please use pytest.Module instead | ||||||
|         return getattr(object, name, default) |         return getattr(object, name, default) | ||||||
| 
 | 
 | ||||||
|     -- Docs: https://docs.pytest.org/en/latest/warnings.html |     -- Docs: https://docs.pytest.org/en/latest/warnings.html | ||||||
|  |  | ||||||
|  | @ -389,13 +389,13 @@ class PytestPluginManager(PluginManager): | ||||||
|         if self._noconftest: |         if self._noconftest: | ||||||
|             return [] |             return [] | ||||||
| 
 | 
 | ||||||
|  |         try: | ||||||
|  |             return self._path2confmods[path] | ||||||
|  |         except KeyError: | ||||||
|             if path.isfile(): |             if path.isfile(): | ||||||
|                 directory = path.dirpath() |                 directory = path.dirpath() | ||||||
|             else: |             else: | ||||||
|                 directory = path |                 directory = path | ||||||
|         try: |  | ||||||
|             return self._path2confmods[directory] |  | ||||||
|         except KeyError: |  | ||||||
|             # XXX these days we may rather want to use config.rootdir |             # XXX these days we may rather want to use config.rootdir | ||||||
|             # and allow users to opt into looking into the rootdir parent |             # and allow users to opt into looking into the rootdir parent | ||||||
|             # directories instead of requiring to specify confcutdir |             # directories instead of requiring to specify confcutdir | ||||||
|  | @ -408,7 +408,7 @@ class PytestPluginManager(PluginManager): | ||||||
|                     mod = self._importconftest(conftestpath) |                     mod = self._importconftest(conftestpath) | ||||||
|                     clist.append(mod) |                     clist.append(mod) | ||||||
| 
 | 
 | ||||||
|             self._path2confmods[directory] = clist |             self._path2confmods[path] = clist | ||||||
|             return clist |             return clist | ||||||
| 
 | 
 | ||||||
|     def _rget_with_confmod(self, name, path): |     def _rget_with_confmod(self, name, path): | ||||||
|  |  | ||||||
|  | @ -151,7 +151,7 @@ def create_cleanup_lock(p): | ||||||
|     else: |     else: | ||||||
|         pid = os.getpid() |         pid = os.getpid() | ||||||
|         spid = str(pid) |         spid = str(pid) | ||||||
|         if not isinstance(spid, six.binary_type): |         if not isinstance(spid, bytes): | ||||||
|             spid = spid.encode("ascii") |             spid = spid.encode("ascii") | ||||||
|         os.write(fd, spid) |         os.write(fd, spid) | ||||||
|         os.close(fd) |         os.close(fd) | ||||||
|  | @ -177,9 +177,15 @@ def register_cleanup_lock_removal(lock_path, register=atexit.register): | ||||||
|     return register(cleanup_on_exit) |     return register(cleanup_on_exit) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| def delete_a_numbered_dir(path): | def maybe_delete_a_numbered_dir(path): | ||||||
|     """removes a numbered directory""" |     """removes a numbered directory if its lock can be obtained""" | ||||||
|  |     try: | ||||||
|         create_cleanup_lock(path) |         create_cleanup_lock(path) | ||||||
|  |     except (OSError, EnvironmentError): | ||||||
|  |         #  known races: | ||||||
|  |         #  * other process did a cleanup at the same time | ||||||
|  |         #  * deletable folder was found | ||||||
|  |         return | ||||||
|     parent = path.parent |     parent = path.parent | ||||||
| 
 | 
 | ||||||
|     garbage = parent.joinpath("garbage-{}".format(uuid.uuid4())) |     garbage = parent.joinpath("garbage-{}".format(uuid.uuid4())) | ||||||
|  | @ -209,7 +215,7 @@ def ensure_deletable(path, consider_lock_dead_if_created_before): | ||||||
| def try_cleanup(path, consider_lock_dead_if_created_before): | def try_cleanup(path, consider_lock_dead_if_created_before): | ||||||
|     """tries to cleanup a folder if we can ensure its deletable""" |     """tries to cleanup a folder if we can ensure its deletable""" | ||||||
|     if ensure_deletable(path, consider_lock_dead_if_created_before): |     if ensure_deletable(path, consider_lock_dead_if_created_before): | ||||||
|         delete_a_numbered_dir(path) |         maybe_delete_a_numbered_dir(path) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| def cleanup_candidates(root, prefix, keep): | def cleanup_candidates(root, prefix, keep): | ||||||
|  |  | ||||||
|  | @ -156,21 +156,27 @@ class WarningsRecorder(warnings.catch_warnings): | ||||||
|         # trivial patching of `warnings.warn` seems to be enough somehow? |         # trivial patching of `warnings.warn` seems to be enough somehow? | ||||||
|         if six.PY2: |         if six.PY2: | ||||||
| 
 | 
 | ||||||
|             def warn(*args, **kwargs): |             def warn(message, category=None, stacklevel=1): | ||||||
|                 kwargs.setdefault("stacklevel", 1) |                 # duplicate the stdlib logic due to | ||||||
|                 kwargs["stacklevel"] += 1 |                 # bad handing in the c version of warnings | ||||||
|  |                 if isinstance(message, Warning): | ||||||
|  |                     category = message.__class__ | ||||||
|  |                 # Check category argument | ||||||
|  |                 if category is None: | ||||||
|  |                     category = UserWarning | ||||||
|  |                 assert issubclass(category, Warning) | ||||||
| 
 | 
 | ||||||
|                 # emulate resetting the warn registry |                 # emulate resetting the warn registry | ||||||
|                 f_globals = sys._getframe(kwargs["stacklevel"] - 1).f_globals |                 f_globals = sys._getframe(stacklevel).f_globals | ||||||
|                 if "__warningregistry__" in f_globals: |                 if "__warningregistry__" in f_globals: | ||||||
|                     orig = f_globals["__warningregistry__"] |                     orig = f_globals["__warningregistry__"] | ||||||
|                     f_globals["__warningregistry__"] = None |                     f_globals["__warningregistry__"] = None | ||||||
|                     try: |                     try: | ||||||
|                         return self._saved_warn(*args, **kwargs) |                         return self._saved_warn(message, category, stacklevel + 1) | ||||||
|                     finally: |                     finally: | ||||||
|                         f_globals["__warningregistry__"] = orig |                         f_globals["__warningregistry__"] = orig | ||||||
|                 else: |                 else: | ||||||
|                     return self._saved_warn(*args, **kwargs) |                     return self._saved_warn(message, category, stacklevel + 1) | ||||||
| 
 | 
 | ||||||
|             warnings.warn, self._saved_warn = warn, warnings.warn |             warnings.warn, self._saved_warn = warn, warnings.warn | ||||||
|         return self |         return self | ||||||
|  |  | ||||||
|  | @ -0,0 +1 @@ | ||||||
|  | foo_* | ||||||
|  | @ -0,0 +1,28 @@ | ||||||
|  | import argparse | ||||||
|  | import pathlib | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | HERE = pathlib.Path(__file__).parent | ||||||
|  | TEST_CONTENT = (HERE / "template_test.py").read_bytes() | ||||||
|  | 
 | ||||||
|  | parser = argparse.ArgumentParser() | ||||||
|  | parser.add_argument("numbers", nargs="*", type=int) | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | def generate_folders(root, elements, *more_numbers): | ||||||
|  |     fill_len = len(str(elements)) | ||||||
|  |     if more_numbers: | ||||||
|  |         for i in range(elements): | ||||||
|  |             new_folder = root.joinpath(f"foo_{i:0>{fill_len}}") | ||||||
|  |             new_folder.mkdir() | ||||||
|  |             new_folder.joinpath("__init__.py").write_bytes(TEST_CONTENT) | ||||||
|  |             generate_folders(new_folder, *more_numbers) | ||||||
|  |     else: | ||||||
|  |         for i in range(elements): | ||||||
|  |             new_test = root.joinpath(f"test_{i:0<{fill_len}}.py") | ||||||
|  |             new_test.write_bytes(TEST_CONTENT) | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | if __name__ == "__main__": | ||||||
|  |     args = parser.parse_args() | ||||||
|  |     generate_folders(HERE, *(args.numbers or (10, 100))) | ||||||
|  | @ -0,0 +1,2 @@ | ||||||
|  | def test_x(): | ||||||
|  |     pass | ||||||
|  | @ -46,6 +46,12 @@ class TestWarningsRecorderChecker(object): | ||||||
|             assert values is rec.list |             assert values is rec.list | ||||||
|             pytest.raises(AssertionError, "rec.pop()") |             pytest.raises(AssertionError, "rec.pop()") | ||||||
| 
 | 
 | ||||||
|  |     @pytest.mark.issue(4243) | ||||||
|  |     def test_warn_stacklevel(self): | ||||||
|  |         rec = WarningsRecorder() | ||||||
|  |         with rec: | ||||||
|  |             warnings.warn("test", DeprecationWarning, 2) | ||||||
|  | 
 | ||||||
|     def test_typechecking(self): |     def test_typechecking(self): | ||||||
|         from _pytest.recwarn import WarningsChecker |         from _pytest.recwarn import WarningsChecker | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -7,6 +7,7 @@ import sys | ||||||
| import six | import six | ||||||
| 
 | 
 | ||||||
| import pytest | import pytest | ||||||
|  | from _pytest import pathlib | ||||||
| from _pytest.pathlib import Path | from _pytest.pathlib import Path | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | @ -287,11 +288,17 @@ class TestNumberedDir(object): | ||||||
|         rmtree(adir, force=True) |         rmtree(adir, force=True) | ||||||
|         assert not adir.exists() |         assert not adir.exists() | ||||||
| 
 | 
 | ||||||
|     def test_cleanup_symlink(self, tmp_path): |     def test_cleanup_ignores_symlink(self, tmp_path): | ||||||
|         the_symlink = tmp_path / (self.PREFIX + "current") |         the_symlink = tmp_path / (self.PREFIX + "current") | ||||||
|         attempt_symlink_to(the_symlink, tmp_path / (self.PREFIX + "5")) |         attempt_symlink_to(the_symlink, tmp_path / (self.PREFIX + "5")) | ||||||
|         self._do_cleanup(tmp_path) |         self._do_cleanup(tmp_path) | ||||||
| 
 | 
 | ||||||
|  |     def test_removal_accepts_lock(self, tmp_path): | ||||||
|  |         folder = pathlib.make_numbered_dir(root=tmp_path, prefix=self.PREFIX) | ||||||
|  |         pathlib.create_cleanup_lock(folder) | ||||||
|  |         pathlib.maybe_delete_a_numbered_dir(folder) | ||||||
|  |         assert folder.is_dir() | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| def attempt_symlink_to(path, to_path): | def attempt_symlink_to(path, to_path): | ||||||
|     """Try to make a symlink from "path" to "to_path", skipping in case this platform |     """Try to make a symlink from "path" to "to_path", skipping in case this platform | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue