diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 21a090414..9c9d254d0 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -8,6 +8,52 @@ .. towncrier release notes start +Pytest 3.6.3 (2018-07-04) +========================= + +Bug Fixes +--------- + +- Fix ``ImportWarning`` triggered by explicit relative imports in + assertion-rewritten package modules. (`#3061 + `_) + +- Fix error in ``pytest.approx`` when dealing with 0-dimension numpy + arrays. (`#3593 `_) + +- No longer raise ``ValueError`` when using the ``get_marker`` API. (`#3605 + `_) + +- Fix problem where log messages with non-ascii characters would not + appear in the output log file. + (`#3630 `_) + +- No longer raise ``AttributeError`` when legacy marks can't be stored in + functions. (`#3631 `_) + + +Improved Documentation +---------------------- + +- The description above the example for ``@pytest.mark.skipif`` now better + matches the code. (`#3611 + `_) + + +Trivial/Internal Changes +------------------------ + +- Internal refactoring: removed unused ``CallSpec2tox ._globalid_args`` + attribute and ``metafunc`` parameter from ``CallSpec2.copy()``. (`#3598 + `_) + +- Silence usage of ``reduce`` warning in Python 2 (`#3609 + `_) + +- Fix usage of ``attr.ib`` deprecated ``convert`` parameter. (`#3653 + `_) + + Pytest 3.6.2 (2018-06-20) ========================= diff --git a/HOWTORELEASE.rst b/HOWTORELEASE.rst index 97bddf720..b5e852d3b 100644 --- a/HOWTORELEASE.rst +++ b/HOWTORELEASE.rst @@ -10,10 +10,6 @@ taking a lot of time to make a new one. pytest releases must be prepared on **Linux** because the docs and examples expect to be executed in that platform. -#. Install development dependencies in a virtual environment with:: - - pip3 install -U -r tasks/requirements.txt - #. Create a branch ``release-X.Y.Z`` with the version for the release. * **patch releases**: from the latest ``master``; @@ -22,9 +18,19 @@ taking a lot of time to make a new one. Ensure your are in a clean work tree. -#. Generate docs, changelog, announcements and a **local** tag:: +#. Install development dependencies in a virtual environment with:: + + $ pip3 install -U -r tasks/requirements.txt + +#. Generate docs, changelog, announcements, and a **local** tag:: + + $ invoke generate.pre-release + +#. Execute pre-commit on all files to ensure the docs are conformant and commit your results:: + + $ pre-commit run --all-files + $ git commit -am "Fix files with pre-commit" - invoke generate.pre-release #. Open a PR for this branch targeting ``master``. diff --git a/changelog/3061.bugfix.rst b/changelog/3061.bugfix.rst deleted file mode 100644 index 1bdd1064e..000000000 --- a/changelog/3061.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fix ``ImportWarning`` triggered by explicit relative imports in assertion-rewritten package modules. diff --git a/changelog/3593.bugfix.rst b/changelog/3593.bugfix.rst deleted file mode 100644 index 37aa30577..000000000 --- a/changelog/3593.bugfix.rst +++ /dev/null @@ -1,5 +0,0 @@ -If the user pass as a expected value a numpy array created like -numpy.array(5); it will creates an array with one element without shape, -when used with approx it will raise an error for the `repr` -'TypeError: iteration over a 0-d array'. With this PR pytest will iterate -properly in the numpy array even with 0 dimension. diff --git a/changelog/3598.trivial.rst b/changelog/3598.trivial.rst deleted file mode 100644 index fd80f58cd..000000000 --- a/changelog/3598.trivial.rst +++ /dev/null @@ -1 +0,0 @@ -Internal refactoring: removed unused ``CallSpec2tox ._globalid_args`` attribute and ``metafunc`` parameter from ``CallSpec2.copy()``. diff --git a/changelog/3605.bugfix.rst b/changelog/3605.bugfix.rst deleted file mode 100644 index 58a294ecb..000000000 --- a/changelog/3605.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -no longer ValueError when using the ``get_marker`` api. diff --git a/changelog/3609.trivial.rst b/changelog/3609.trivial.rst deleted file mode 100644 index 96e720d92..000000000 --- a/changelog/3609.trivial.rst +++ /dev/null @@ -1 +0,0 @@ -Silence usage of ``reduce`` warning in python 2 diff --git a/changelog/3611.doc.rst b/changelog/3611.doc.rst deleted file mode 100644 index fe19cc025..000000000 --- a/changelog/3611.doc.rst +++ /dev/null @@ -1 +0,0 @@ -The description above the example for ``@pytest.mark.skipif`` now better matches the code. diff --git a/changelog/3630.bugfix.rst b/changelog/3630.bugfix.rst deleted file mode 100644 index 505bcb8fd..000000000 --- a/changelog/3630.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Log messages with unicode characters would not appear in the output log file. diff --git a/changelog/3631.bugfix.rst b/changelog/3631.bugfix.rst deleted file mode 100644 index 261c41ccd..000000000 --- a/changelog/3631.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -No longer raise AttributeError when legacy marks can't be stored. diff --git a/changelog/3653.trivial.rst b/changelog/3653.trivial.rst deleted file mode 100644 index 51fe2238e..000000000 --- a/changelog/3653.trivial.rst +++ /dev/null @@ -1 +0,0 @@ -Fix usage of ``attr.ib`` deprecated ``convert`` parameter. diff --git a/doc/en/announce/index.rst b/doc/en/announce/index.rst index 107fcd2ad..8283bf86d 100644 --- a/doc/en/announce/index.rst +++ b/doc/en/announce/index.rst @@ -6,6 +6,7 @@ Release announcements :maxdepth: 2 + release-3.6.3 release-3.6.2 release-3.6.1 release-3.6.0 diff --git a/doc/en/announce/release-3.6.3.rst b/doc/en/announce/release-3.6.3.rst new file mode 100644 index 000000000..1aff2bc38 --- /dev/null +++ b/doc/en/announce/release-3.6.3.rst @@ -0,0 +1,28 @@ +pytest-3.6.3 +======================================= + +pytest 3.6.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 http://doc.pytest.org/en/latest/changelog.html. + +Thanks to all who contributed to this release, among them: + +* AdamEr8 +* Anthony Sottile +* Bruno Oliveira +* Jean-Paul Calderone +* Jon Dufresne +* Marcelo Duarte Trevisani +* Ondřej Súkup +* Ronny Pfannschmidt +* T.E.A de Souza +* Victor +* victor + + +Happy testing, +The pytest Development Team diff --git a/doc/en/builtin.rst b/doc/en/builtin.rst index c2d23469b..e52151a1b 100644 --- a/doc/en/builtin.rst +++ b/doc/en/builtin.rst @@ -90,7 +90,7 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a monkeypatch.setitem(mapping, name, value) monkeypatch.delitem(obj, name, raising=True) monkeypatch.setenv(name, value, prepend=False) - monkeypatch.delenv(name, value, raising=True) + monkeypatch.delenv(name, raising=True) monkeypatch.syspath_prepend(path) monkeypatch.chdir(path) diff --git a/doc/en/example/reportingdemo.rst b/doc/en/example/reportingdemo.rst index 4691b128b..a7cc81694 100644 --- a/doc/en/example/reportingdemo.rst +++ b/doc/en/example/reportingdemo.rst @@ -32,7 +32,6 @@ get on the terminal - we are working on that):: self = def test_simple(self): - def f(): return 42 @@ -44,7 +43,7 @@ get on the terminal - we are working on that):: E + where 42 = .f at 0xdeadbeef>() E + and 43 = .g at 0xdeadbeef>() - failure_demo.py:37: AssertionError + failure_demo.py:35: AssertionError ____________________ TestFailing.test_simple_multiline _____________________ self = @@ -52,7 +51,7 @@ get on the terminal - we are working on that):: def test_simple_multiline(self): > otherfunc_multi(42, 6 * 9) - failure_demo.py:40: + failure_demo.py:38: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ a = 42, b = 54 @@ -67,7 +66,6 @@ get on the terminal - we are working on that):: self = def test_not(self): - def f(): return 42 @@ -75,7 +73,7 @@ get on the terminal - we are working on that):: E assert not 42 E + where 42 = .f at 0xdeadbeef>() - failure_demo.py:47: AssertionError + failure_demo.py:44: AssertionError _________________ TestSpecialisedExplanations.test_eq_text _________________ self = @@ -86,7 +84,7 @@ get on the terminal - we are working on that):: E - spam E + eggs - failure_demo.py:53: AssertionError + failure_demo.py:49: AssertionError _____________ TestSpecialisedExplanations.test_eq_similar_text _____________ self = @@ -99,7 +97,7 @@ get on the terminal - we are working on that):: E + foo 2 bar E ? ^ - failure_demo.py:56: AssertionError + failure_demo.py:52: AssertionError ____________ TestSpecialisedExplanations.test_eq_multiline_text ____________ self = @@ -112,7 +110,7 @@ get on the terminal - we are working on that):: E + eggs E bar - failure_demo.py:59: AssertionError + failure_demo.py:55: AssertionError ______________ TestSpecialisedExplanations.test_eq_long_text _______________ self = @@ -129,7 +127,7 @@ get on the terminal - we are working on that):: E + 1111111111b222222222 E ? ^ - failure_demo.py:64: AssertionError + failure_demo.py:60: AssertionError _________ TestSpecialisedExplanations.test_eq_long_text_multiline __________ self = @@ -149,7 +147,7 @@ get on the terminal - we are working on that):: E E ...Full output truncated (7 lines hidden), use '-vv' to show - failure_demo.py:69: AssertionError + failure_demo.py:65: AssertionError _________________ TestSpecialisedExplanations.test_eq_list _________________ self = @@ -160,7 +158,7 @@ get on the terminal - we are working on that):: E At index 2 diff: 2 != 3 E Use -v to get the full diff - failure_demo.py:72: AssertionError + failure_demo.py:68: AssertionError ______________ TestSpecialisedExplanations.test_eq_list_long _______________ self = @@ -173,7 +171,7 @@ get on the terminal - we are working on that):: E At index 100 diff: 1 != 2 E Use -v to get the full diff - failure_demo.py:77: AssertionError + failure_demo.py:73: AssertionError _________________ TestSpecialisedExplanations.test_eq_dict _________________ self = @@ -191,7 +189,7 @@ get on the terminal - we are working on that):: E E ...Full output truncated (2 lines hidden), use '-vv' to show - failure_demo.py:80: AssertionError + failure_demo.py:76: AssertionError _________________ TestSpecialisedExplanations.test_eq_set __________________ self = @@ -209,7 +207,7 @@ get on the terminal - we are working on that):: E E ...Full output truncated (2 lines hidden), use '-vv' to show - failure_demo.py:83: AssertionError + failure_demo.py:79: AssertionError _____________ TestSpecialisedExplanations.test_eq_longer_list ______________ self = @@ -220,7 +218,7 @@ get on the terminal - we are working on that):: E Right contains more items, first extra item: 3 E Use -v to get the full diff - failure_demo.py:86: AssertionError + failure_demo.py:82: AssertionError _________________ TestSpecialisedExplanations.test_in_list _________________ self = @@ -229,7 +227,7 @@ get on the terminal - we are working on that):: > assert 1 in [0, 2, 3, 4, 5] E assert 1 in [0, 2, 3, 4, 5] - failure_demo.py:89: AssertionError + failure_demo.py:85: AssertionError __________ TestSpecialisedExplanations.test_not_in_text_multiline __________ self = @@ -248,7 +246,7 @@ get on the terminal - we are working on that):: E E ...Full output truncated (2 lines hidden), use '-vv' to show - failure_demo.py:93: AssertionError + failure_demo.py:89: AssertionError ___________ TestSpecialisedExplanations.test_not_in_text_single ____________ self = @@ -261,7 +259,7 @@ get on the terminal - we are working on that):: E single foo line E ? +++ - failure_demo.py:97: AssertionError + failure_demo.py:93: AssertionError _________ TestSpecialisedExplanations.test_not_in_text_single_long _________ self = @@ -274,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 ? +++ - failure_demo.py:101: AssertionError + failure_demo.py:97: AssertionError ______ TestSpecialisedExplanations.test_not_in_text_single_long_term _______ self = @@ -287,11 +285,10 @@ 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 ? ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - failure_demo.py:105: AssertionError + failure_demo.py:101: AssertionError ______________________________ test_attribute ______________________________ def test_attribute(): - class Foo(object): b = 1 @@ -300,11 +297,10 @@ get on the terminal - we are working on that):: E assert 1 == 2 E + where 1 = .Foo object at 0xdeadbeef>.b - failure_demo.py:114: AssertionError + failure_demo.py:109: AssertionError _________________________ test_attribute_instance __________________________ def test_attribute_instance(): - class Foo(object): b = 1 @@ -313,13 +309,11 @@ get on the terminal - we are working on that):: E + where 1 = .Foo object at 0xdeadbeef>.b E + where .Foo object at 0xdeadbeef> = .Foo'>() - failure_demo.py:122: AssertionError + failure_demo.py:116: AssertionError __________________________ test_attribute_failure __________________________ def test_attribute_failure(): - class Foo(object): - def _get_b(self): raise Exception("Failed to get attrib") @@ -328,7 +322,7 @@ get on the terminal - we are working on that):: i = Foo() > assert i.b == 2 - failure_demo.py:135: + failure_demo.py:127: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = .Foo object at 0xdeadbeef> @@ -337,11 +331,10 @@ get on the terminal - we are working on that):: > raise Exception("Failed to get attrib") E Exception: Failed to get attrib - failure_demo.py:130: Exception + failure_demo.py:122: Exception _________________________ test_attribute_multiple __________________________ def test_attribute_multiple(): - class Foo(object): b = 1 @@ -355,7 +348,7 @@ get on the terminal - we are working on that):: E + and 2 = .Bar object at 0xdeadbeef>.b E + where .Bar object at 0xdeadbeef> = .Bar'>() - failure_demo.py:146: AssertionError + failure_demo.py:137: AssertionError __________________________ TestRaises.test_raises __________________________ self = @@ -364,13 +357,13 @@ get on the terminal - we are working on that):: s = "qwe" # NOQA > raises(TypeError, "int(s)") - failure_demo.py:157: + failure_demo.py:147: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > int(s) E ValueError: invalid literal for int() with base 10: 'qwe' - <0-codegen $PYTHON_PREFIX/lib/python3.5/site-packages/_pytest/python_api.py:634>:1: ValueError + <0-codegen $PYTHON_PREFIX/lib/python3.5/site-packages/_pytest/python_api.py:635>:1: ValueError ______________________ TestRaises.test_raises_doesnt _______________________ self = @@ -379,7 +372,7 @@ get on the terminal - we are working on that):: > raises(IOError, "int('3')") E Failed: DID NOT RAISE - failure_demo.py:160: Failed + failure_demo.py:150: Failed __________________________ TestRaises.test_raise ___________________________ self = @@ -388,7 +381,7 @@ get on the terminal - we are working on that):: > raise ValueError("demo error") E ValueError: demo error - failure_demo.py:163: ValueError + failure_demo.py:153: ValueError ________________________ TestRaises.test_tupleerror ________________________ self = @@ -397,7 +390,7 @@ get on the terminal - we are working on that):: > a, b = [1] # NOQA E ValueError: not enough values to unpack (expected 2, got 1) - failure_demo.py:166: ValueError + failure_demo.py:156: ValueError ______ TestRaises.test_reinterpret_fails_with_print_for_the_fun_of_it ______ self = @@ -408,7 +401,7 @@ get on the terminal - we are working on that):: > a, b = items.pop() E TypeError: 'int' object is not iterable - failure_demo.py:171: TypeError + failure_demo.py:161: TypeError --------------------------- Captured stdout call --------------------------- items is [1, 2, 3] ________________________ TestRaises.test_some_error ________________________ @@ -419,7 +412,7 @@ get on the terminal - we are working on that):: > if namenotexi: # NOQA E NameError: name 'namenotexi' is not defined - failure_demo.py:174: NameError + failure_demo.py:164: NameError ____________________ test_dynamic_compile_shows_nicely _____________________ def test_dynamic_compile_shows_nicely(): @@ -434,20 +427,19 @@ get on the terminal - we are working on that):: sys.modules[name] = module > module.foo() - failure_demo.py:192: + failure_demo.py:182: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ def foo(): > assert 1 == 0 E AssertionError - <2-codegen 'abc-123' $REGENDOC_TMPDIR/assertion/failure_demo.py:189>:2: AssertionError + <2-codegen 'abc-123' $REGENDOC_TMPDIR/assertion/failure_demo.py:179>:2: AssertionError ____________________ TestMoreErrors.test_complex_error _____________________ self = def test_complex_error(self): - def f(): return 44 @@ -456,7 +448,7 @@ get on the terminal - we are working on that):: > somefunc(f(), g()) - failure_demo.py:205: + failure_demo.py:193: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ failure_demo.py:11: in somefunc otherfunc(x, y) @@ -478,7 +470,7 @@ get on the terminal - we are working on that):: > a, b = items E ValueError: not enough values to unpack (expected 2, got 0) - failure_demo.py:209: ValueError + failure_demo.py:197: ValueError ____________________ TestMoreErrors.test_z2_type_error _____________________ self = @@ -488,7 +480,7 @@ get on the terminal - we are working on that):: > a, b = items E TypeError: 'int' object is not iterable - failure_demo.py:213: TypeError + failure_demo.py:201: TypeError ______________________ TestMoreErrors.test_startswith ______________________ self = @@ -501,13 +493,12 @@ get on the terminal - we are working on that):: E + where False = ('456') E + where = '123'.startswith - failure_demo.py:218: AssertionError + failure_demo.py:206: AssertionError __________________ TestMoreErrors.test_startswith_nested ___________________ self = def test_startswith_nested(self): - def f(): return "123" @@ -521,7 +512,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:228: AssertionError + failure_demo.py:215: AssertionError _____________________ TestMoreErrors.test_global_func ______________________ self = @@ -532,7 +523,7 @@ get on the terminal - we are working on that):: E + where False = isinstance(43, float) E + where 43 = globf(42) - failure_demo.py:231: AssertionError + failure_demo.py:218: AssertionError _______________________ TestMoreErrors.test_instance _______________________ self = @@ -543,7 +534,7 @@ get on the terminal - we are working on that):: E assert 42 != 42 E + where 42 = .x - failure_demo.py:235: AssertionError + failure_demo.py:222: AssertionError _______________________ TestMoreErrors.test_compare ________________________ self = @@ -553,7 +544,7 @@ get on the terminal - we are working on that):: E assert 11 < 5 E + where 11 = globf(10) - failure_demo.py:238: AssertionError + failure_demo.py:225: AssertionError _____________________ TestMoreErrors.test_try_finally ______________________ self = @@ -564,13 +555,12 @@ get on the terminal - we are working on that):: > assert x == 0 E assert 1 == 0 - failure_demo.py:243: AssertionError + failure_demo.py:230: AssertionError ___________________ TestCustomAssertMsg.test_single_line ___________________ self = def test_single_line(self): - class A(object): a = 1 @@ -580,13 +570,12 @@ get on the terminal - we are working on that):: E assert 1 == 2 E + where 1 = .A'>.a - failure_demo.py:256: AssertionError + failure_demo.py:241: AssertionError ____________________ TestCustomAssertMsg.test_multiline ____________________ self = def test_multiline(self): - class A(object): a = 1 @@ -600,13 +589,12 @@ get on the terminal - we are working on that):: E assert 1 == 2 E + where 1 = .A'>.a - failure_demo.py:264: AssertionError + failure_demo.py:248: AssertionError ___________________ TestCustomAssertMsg.test_custom_repr ___________________ self = def test_custom_repr(self): - class JSON(object): a = 1 @@ -623,7 +611,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:278: AssertionError + failure_demo.py:261: AssertionError ============================= warnings summary ============================= 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 180637ae9..ed2c9d67a 100644 --- a/doc/en/example/simple.rst +++ b/doc/en/example/simple.rst @@ -416,7 +416,7 @@ Now we can profile which test functions execute the slowest:: ========================= slowest 3 test durations ========================= 0.30s call test_some_are_slow.py::test_funcslow2 0.20s call test_some_are_slow.py::test_funcslow1 - 0.10s call test_some_are_slow.py::test_funcfast + 0.13s call test_some_are_slow.py::test_funcfast ========================= 3 passed in 0.12 seconds ========================= incremental testing - test steps