4.2.0
pytest 4.2.0 (2019-01-30)
Features
-
#3094: Classic
xunit-style
functions and methods now obey the scope of autouse fixtures.This fixes a number of surprising issues like
setup_method
being
called before session-scoped autouse fixtures (see
#517 for an
example). -
#4627: Display
a message at the end of the test session when running under Python
2.7 and 3.4 that pytest 5.0 will no longer support those Python
versions. -
#4660: The
number of selected tests now are also displayed when the-k
or
-m
flags are used. -
#4688:
pytest_report_teststatus
hook now can also receive aconfig
parameter. -
#4691:
pytest_terminal_summary
hook now can also receive aconfig
parameter.
Bug Fixes
-
#3547:
--junitxml
can emit XML compatible with Jenkins xUnit.
junit_family
INI option acceptslegacy|xunit1
, which produces
old style output, andxunit2
that conforms more strictly to
https://github.com/jenkinsci/xunit-plugin/blob/xunit-2.3.2/src/main/resources/org/jenkinsci/plugins/xunit/types/model/xsd/junit-10.xsd -
#4280: Improve
quitting from pdb, especially with--trace
.Using
q[quit]
afterpdb.set_trace()
will quit pytest also. -
#4402: Warning
summary now groups warnings by message instead of by test id.This makes the output more compact and better conveys the general
idea of how much code is actually generating warnings, instead of
how many tests call that code. -
#4536:
monkeypatch.delattr
handles class descriptors like
staticmethod
/classmethod
. -
#4649: Restore
marks being considered keywords for keyword expressions. -
#4653:
tmp_path
fixture and other related ones provides resolved path
(a.k.a real path) -
#4667:
pytest_terminal_summary
uses result from
pytest_report_teststatus
hook, rather than hardcoded strings. -
#4669:
Correctly handleunittest.SkipTest
exception containing non-ascii
characters on Python 2. -
#4680: Ensure
thetmpdir
and thetmp_path
fixtures are the same folder. -
#4681: Ensure
tmp_path
is always a real path.
Trivial/Internal Changes
-
#4643: Use
a.item()
instead of the deprecatednp.asscalar(a)
in
pytest.approx
.np.asscalar
has been
deprecated
innumpy 1.16.
. -
#4657: Copy
saferepr from pylib -
#4668: The
verbose word for expected failures in the teststatus report changes
fromxfail
toXFAIL
to be consistent with other test outcomes.