commit
01d2d81d1f
|
@ -1206,7 +1206,7 @@ Changes
|
||||||
* Testcase reports with a ``url`` attribute will now properly write this to junitxml.
|
* Testcase reports with a ``url`` attribute will now properly write this to junitxml.
|
||||||
Thanks `@fushi`_ for the PR (`#1874`_).
|
Thanks `@fushi`_ for the PR (`#1874`_).
|
||||||
|
|
||||||
* Remove common items from dict comparision output when verbosity=1. Also update
|
* Remove common items from dict comparison output when verbosity=1. Also update
|
||||||
the truncation message to make it clearer that pytest truncates all
|
the truncation message to make it clearer that pytest truncates all
|
||||||
assertion messages if verbosity < 2 (`#1512`_).
|
assertion messages if verbosity < 2 (`#1512`_).
|
||||||
Thanks `@mattduck`_ for the PR
|
Thanks `@mattduck`_ for the PR
|
||||||
|
@ -1218,7 +1218,7 @@ Changes
|
||||||
* fix `#2013`_: turn RecordedWarning into ``namedtuple``,
|
* fix `#2013`_: turn RecordedWarning into ``namedtuple``,
|
||||||
to give it a comprehensible repr while preventing unwarranted modification.
|
to give it a comprehensible repr while preventing unwarranted modification.
|
||||||
|
|
||||||
* fix `#2208`_: ensure a iteration limit for _pytest.compat.get_real_func.
|
* fix `#2208`_: ensure an iteration limit for _pytest.compat.get_real_func.
|
||||||
Thanks `@RonnyPfannschmidt`_ for the report and PR.
|
Thanks `@RonnyPfannschmidt`_ for the report and PR.
|
||||||
|
|
||||||
* Hooks are now verified after collection is complete, rather than right after loading installed plugins. This
|
* Hooks are now verified after collection is complete, rather than right after loading installed plugins. This
|
||||||
|
@ -1322,7 +1322,7 @@ Bug Fixes
|
||||||
Notably, importing the ``anydbm`` module is fixed. (`#2248`_).
|
Notably, importing the ``anydbm`` module is fixed. (`#2248`_).
|
||||||
Thanks `@pfhayes`_ for the PR.
|
Thanks `@pfhayes`_ for the PR.
|
||||||
|
|
||||||
* junitxml: Fix problematic case where system-out tag occured twice per testcase
|
* junitxml: Fix problematic case where system-out tag occurred twice per testcase
|
||||||
element in the XML report. Thanks `@kkoukiou`_ for the PR.
|
element in the XML report. Thanks `@kkoukiou`_ for the PR.
|
||||||
|
|
||||||
* Fix regression, pytest now skips unittest correctly if run with ``--pdb``
|
* Fix regression, pytest now skips unittest correctly if run with ``--pdb``
|
||||||
|
@ -2918,7 +2918,7 @@ time or change existing behaviors in order to make them less surprising/more use
|
||||||
"::" node id specifications (copy pasted from "-v" output)
|
"::" node id specifications (copy pasted from "-v" output)
|
||||||
|
|
||||||
- fix issue544 by only removing "@NUM" at the end of "::" separated parts
|
- fix issue544 by only removing "@NUM" at the end of "::" separated parts
|
||||||
and if the part has an ".py" extension
|
and if the part has a ".py" extension
|
||||||
|
|
||||||
- don't use py.std import helper, rather import things directly.
|
- don't use py.std import helper, rather import things directly.
|
||||||
Thanks Bruno Oliveira.
|
Thanks Bruno Oliveira.
|
||||||
|
@ -3189,7 +3189,7 @@ time or change existing behaviors in order to make them less surprising/more use
|
||||||
|
|
||||||
would not work correctly because pytest assumes @pytest.mark.some
|
would not work correctly because pytest assumes @pytest.mark.some
|
||||||
gets a function to be decorated already. We now at least detect if this
|
gets a function to be decorated already. We now at least detect if this
|
||||||
arg is an lambda and thus the example will work. Thanks Alex Gaynor
|
arg is a lambda and thus the example will work. Thanks Alex Gaynor
|
||||||
for bringing it up.
|
for bringing it up.
|
||||||
|
|
||||||
- xfail a test on pypy that checks wrong encoding/ascii (pypy does
|
- xfail a test on pypy that checks wrong encoding/ascii (pypy does
|
||||||
|
@ -3502,7 +3502,7 @@ Bug fixes:
|
||||||
rather use the post-2.0 parametrize features instead of yield, see:
|
rather use the post-2.0 parametrize features instead of yield, see:
|
||||||
http://pytest.org/latest/example/parametrize.html
|
http://pytest.org/latest/example/parametrize.html
|
||||||
- fix autouse-issue where autouse-fixtures would not be discovered
|
- fix autouse-issue where autouse-fixtures would not be discovered
|
||||||
if defined in a a/conftest.py file and tests in a/tests/test_some.py
|
if defined in an a/conftest.py file and tests in a/tests/test_some.py
|
||||||
- fix issue226 - LIFO ordering for fixture teardowns
|
- fix issue226 - LIFO ordering for fixture teardowns
|
||||||
- fix issue224 - invocations with >256 char arguments now work
|
- fix issue224 - invocations with >256 char arguments now work
|
||||||
- fix issue91 - add/discuss package/directory level setups in example
|
- fix issue91 - add/discuss package/directory level setups in example
|
||||||
|
@ -4072,7 +4072,7 @@ Bug fixes:
|
||||||
- make path.bestrelpath(path) return ".", note that when calling
|
- make path.bestrelpath(path) return ".", note that when calling
|
||||||
X.bestrelpath the assumption is that X is a directory.
|
X.bestrelpath the assumption is that X is a directory.
|
||||||
- make initial conftest discovery ignore "--" prefixed arguments
|
- make initial conftest discovery ignore "--" prefixed arguments
|
||||||
- fix resultlog plugin when used in an multicpu/multihost xdist situation
|
- fix resultlog plugin when used in a multicpu/multihost xdist situation
|
||||||
(thanks Jakub Gustak)
|
(thanks Jakub Gustak)
|
||||||
- perform distributed testing related reporting in the xdist-plugin
|
- perform distributed testing related reporting in the xdist-plugin
|
||||||
rather than having dist-related code in the generic py.test
|
rather than having dist-related code in the generic py.test
|
||||||
|
|
|
@ -14,7 +14,7 @@ cpy_compile = compile
|
||||||
|
|
||||||
|
|
||||||
class Source(object):
|
class Source(object):
|
||||||
""" a immutable object holding a source code fragment,
|
""" an immutable object holding a source code fragment,
|
||||||
possibly deindenting it.
|
possibly deindenting it.
|
||||||
"""
|
"""
|
||||||
_compilecounter = 0
|
_compilecounter = 0
|
||||||
|
|
|
@ -315,7 +315,7 @@ class CaptureFixture(object):
|
||||||
|
|
||||||
|
|
||||||
def safe_text_dupfile(f, mode, default_encoding="UTF8"):
|
def safe_text_dupfile(f, mode, default_encoding="UTF8"):
|
||||||
""" return a open text file object that's a duplicate of f on the
|
""" return an open text file object that's a duplicate of f on the
|
||||||
FD-level if possible.
|
FD-level if possible.
|
||||||
"""
|
"""
|
||||||
encoding = getattr(f, "encoding", None)
|
encoding = getattr(f, "encoding", None)
|
||||||
|
|
|
@ -257,7 +257,7 @@ def safe_getattr(object, name, default):
|
||||||
|
|
||||||
|
|
||||||
def _is_unittest_unexpected_success_a_failure():
|
def _is_unittest_unexpected_success_a_failure():
|
||||||
"""Return if the test suite should fail if a @expectedFailure unittest test PASSES.
|
"""Return if the test suite should fail if an @expectedFailure unittest test PASSES.
|
||||||
|
|
||||||
From https://docs.python.org/3/library/unittest.html?highlight=unittest#unittest.TestResult.wasSuccessful:
|
From https://docs.python.org/3/library/unittest.html?highlight=unittest#unittest.TestResult.wasSuccessful:
|
||||||
Changed in version 3.4: Returns False if there were any
|
Changed in version 3.4: Returns False if there were any
|
||||||
|
|
|
@ -24,7 +24,7 @@ DOCTEST_REPORT_CHOICES = (
|
||||||
DOCTEST_REPORT_CHOICE_ONLY_FIRST_FAILURE,
|
DOCTEST_REPORT_CHOICE_ONLY_FIRST_FAILURE,
|
||||||
)
|
)
|
||||||
|
|
||||||
# Lazy definiton of runner class
|
# Lazy definition of runner class
|
||||||
RUNNER_CLASS = None
|
RUNNER_CLASS = None
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -290,7 +290,7 @@ class FixtureRequest(FuncargnamesCompatAttr):
|
||||||
def _getnextfixturedef(self, argname):
|
def _getnextfixturedef(self, argname):
|
||||||
fixturedefs = self._arg2fixturedefs.get(argname, None)
|
fixturedefs = self._arg2fixturedefs.get(argname, None)
|
||||||
if fixturedefs is None:
|
if fixturedefs is None:
|
||||||
# we arrive here because of a a dynamic call to
|
# we arrive here because of a dynamic call to
|
||||||
# getfixturevalue(argname) usage which was naturally
|
# getfixturevalue(argname) usage which was naturally
|
||||||
# not known at parsing/collection time
|
# not known at parsing/collection time
|
||||||
parentid = self._pyfuncitem.parent.nodeid
|
parentid = self._pyfuncitem.parent.nodeid
|
||||||
|
@ -1026,7 +1026,7 @@ class FixtureManager(object):
|
||||||
def getfixtureclosure(self, fixturenames, parentnode):
|
def getfixtureclosure(self, fixturenames, parentnode):
|
||||||
# collect the closure of all fixtures , starting with the given
|
# collect the closure of all fixtures , starting with the given
|
||||||
# fixturenames as the initial set. As we have to visit all
|
# fixturenames as the initial set. As we have to visit all
|
||||||
# factory definitions anyway, we also return a arg2fixturedefs
|
# factory definitions anyway, we also return an arg2fixturedefs
|
||||||
# mapping so that the caller can reuse it and does not have
|
# mapping so that the caller can reuse it and does not have
|
||||||
# to re-discover fixturedefs again for each fixturename
|
# to re-discover fixturedefs again for each fixturename
|
||||||
# (discovering matching fixtures for a given name/node is expensive)
|
# (discovering matching fixtures for a given name/node is expensive)
|
||||||
|
|
|
@ -90,7 +90,7 @@ def pytest_addoption(parser):
|
||||||
|
|
||||||
|
|
||||||
def pytest_configure(config):
|
def pytest_configure(config):
|
||||||
__import__('pytest').config = config # compatibiltiy
|
__import__('pytest').config = config # compatibility
|
||||||
|
|
||||||
|
|
||||||
def wrap_session(config, doit):
|
def wrap_session(config, doit):
|
||||||
|
@ -290,7 +290,7 @@ class Interrupted(KeyboardInterrupt):
|
||||||
|
|
||||||
|
|
||||||
class Failed(Exception):
|
class Failed(Exception):
|
||||||
""" signals an stop as failed test run. """
|
""" signals a stop as failed test run. """
|
||||||
|
|
||||||
|
|
||||||
class Session(nodes.FSCollector):
|
class Session(nodes.FSCollector):
|
||||||
|
|
|
@ -204,7 +204,7 @@ class MarkDecorator(object):
|
||||||
|
|
||||||
def get_unpacked_marks(obj):
|
def get_unpacked_marks(obj):
|
||||||
"""
|
"""
|
||||||
obtain the unpacked marks that are stored on a object
|
obtain the unpacked marks that are stored on an object
|
||||||
"""
|
"""
|
||||||
mark_list = getattr(obj, 'pytestmark', [])
|
mark_list = getattr(obj, 'pytestmark', [])
|
||||||
|
|
||||||
|
@ -217,7 +217,7 @@ def get_unpacked_marks(obj):
|
||||||
|
|
||||||
|
|
||||||
def store_mark(obj, mark):
|
def store_mark(obj, mark):
|
||||||
"""store a Mark on a object
|
"""store a Mark on an object
|
||||||
this is used to implement the Mark declarations/decorators correctly
|
this is used to implement the Mark declarations/decorators correctly
|
||||||
"""
|
"""
|
||||||
assert isinstance(mark, Mark), mark
|
assert isinstance(mark, Mark), mark
|
||||||
|
|
|
@ -83,7 +83,7 @@ skip.Exception = Skipped
|
||||||
|
|
||||||
|
|
||||||
def fail(msg="", pytrace=True):
|
def fail(msg="", pytrace=True):
|
||||||
""" explicitly fail an currently-executing test with the given Message.
|
""" explicitly fail a currently-executing test with the given Message.
|
||||||
|
|
||||||
:arg pytrace: if false the msg represents the full failure information
|
:arg pytrace: if false the msg represents the full failure information
|
||||||
and no python traceback will be reported.
|
and no python traceback will be reported.
|
||||||
|
|
|
@ -55,7 +55,7 @@ def filter_traceback(entry):
|
||||||
is_generated = '<' in raw_filename and '>' in raw_filename
|
is_generated = '<' in raw_filename and '>' in raw_filename
|
||||||
if is_generated:
|
if is_generated:
|
||||||
return False
|
return False
|
||||||
# entry.path might point to an non-existing file, in which case it will
|
# entry.path might point to a non-existing file, in which case it will
|
||||||
# also return a str object. see #1133
|
# also return a str object. see #1133
|
||||||
p = py.path.local(entry.path)
|
p = py.path.local(entry.path)
|
||||||
return not p.relto(_pluggy_dir) and not p.relto(_pytest_dir) and not p.relto(_py_dir)
|
return not p.relto(_pluggy_dir) and not p.relto(_pytest_dir) and not p.relto(_py_dir)
|
||||||
|
|
|
@ -18,7 +18,7 @@ comes with the following fixes and features:
|
||||||
rather use the post-2.0 parametrize features instead of yield, see:
|
rather use the post-2.0 parametrize features instead of yield, see:
|
||||||
http://pytest.org/latest/example/parametrize.html
|
http://pytest.org/latest/example/parametrize.html
|
||||||
- fix autouse-issue where autouse-fixtures would not be discovered
|
- fix autouse-issue where autouse-fixtures would not be discovered
|
||||||
if defined in a a/conftest.py file and tests in a/tests/test_some.py
|
if defined in an a/conftest.py file and tests in a/tests/test_some.py
|
||||||
- fix issue226 - LIFO ordering for fixture teardowns
|
- fix issue226 - LIFO ordering for fixture teardowns
|
||||||
- fix issue224 - invocations with >256 char arguments now work
|
- fix issue224 - invocations with >256 char arguments now work
|
||||||
- fix issue91 - add/discuss package/directory level setups in example
|
- fix issue91 - add/discuss package/directory level setups in example
|
||||||
|
|
|
@ -52,7 +52,7 @@ Changes 2.6.1
|
||||||
"::" node id specifications (copy pasted from "-v" output)
|
"::" node id specifications (copy pasted from "-v" output)
|
||||||
|
|
||||||
- fix issue544 by only removing "@NUM" at the end of "::" separated parts
|
- fix issue544 by only removing "@NUM" at the end of "::" separated parts
|
||||||
and if the part has an ".py" extension
|
and if the part has a ".py" extension
|
||||||
|
|
||||||
- don't use py.std import helper, rather import things directly.
|
- don't use py.std import helper, rather import things directly.
|
||||||
Thanks Bruno Oliveira.
|
Thanks Bruno Oliveira.
|
||||||
|
|
|
@ -469,7 +469,7 @@ If you run this with reporting for skips enabled::
|
||||||
|
|
||||||
=================== 1 passed, 1 skipped in 0.12 seconds ====================
|
=================== 1 passed, 1 skipped in 0.12 seconds ====================
|
||||||
|
|
||||||
You'll see that we don't have a ``opt2`` module and thus the second test run
|
You'll see that we don't have an ``opt2`` module and thus the second test run
|
||||||
of our ``test_func1`` was skipped. A few notes:
|
of our ``test_func1`` was skipped. A few notes:
|
||||||
|
|
||||||
- the fixture functions in the ``conftest.py`` file are "session-scoped" because we
|
- the fixture functions in the ``conftest.py`` file are "session-scoped" because we
|
||||||
|
|
|
@ -145,7 +145,7 @@ Note that this layout also works in conjunction with the ``src`` layout mentione
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
If ``pytest`` finds a "a/b/test_module.py" test file while
|
If ``pytest`` finds an "a/b/test_module.py" test file while
|
||||||
recursing into the filesystem it determines the import name
|
recursing into the filesystem it determines the import name
|
||||||
as follows:
|
as follows:
|
||||||
|
|
||||||
|
|
|
@ -933,8 +933,8 @@ passed multiple times. The expected format is ``name=value``. For example::
|
||||||
|
|
||||||
Allows to pick the action for empty parametersets in parameterization
|
Allows to pick the action for empty parametersets in parameterization
|
||||||
|
|
||||||
* ``skip`` skips tests with a empty parameterset (default)
|
* ``skip`` skips tests with an empty parameterset (default)
|
||||||
* ``xfail`` marks tests with a empty parameterset as xfail(run=False)
|
* ``xfail`` marks tests with an empty parameterset as xfail(run=False)
|
||||||
|
|
||||||
.. code-block:: ini
|
.. code-block:: ini
|
||||||
|
|
||||||
|
|
|
@ -1198,7 +1198,7 @@ def test_cwd_deleted(testdir):
|
||||||
def test_exception_repr_extraction_error_on_recursion():
|
def test_exception_repr_extraction_error_on_recursion():
|
||||||
"""
|
"""
|
||||||
Ensure we can properly detect a recursion error even
|
Ensure we can properly detect a recursion error even
|
||||||
if some locals raise error on comparision (#2459).
|
if some locals raise error on comparison (#2459).
|
||||||
"""
|
"""
|
||||||
class numpy_like(object):
|
class numpy_like(object):
|
||||||
|
|
||||||
|
|
|
@ -1553,7 +1553,7 @@ class TestAutouseDiscovery(object):
|
||||||
|
|
||||||
def test_callables_nocode(self, testdir):
|
def test_callables_nocode(self, testdir):
|
||||||
"""
|
"""
|
||||||
a imported mock.call would break setup/factory discovery
|
an imported mock.call would break setup/factory discovery
|
||||||
due to it being callable and __code__ not being a code object
|
due to it being callable and __code__ not being a code object
|
||||||
"""
|
"""
|
||||||
testdir.makepyfile("""
|
testdir.makepyfile("""
|
||||||
|
|
|
@ -473,7 +473,7 @@ class TestAssert_reprcompare(object):
|
||||||
def test_one_repr_empty(self):
|
def test_one_repr_empty(self):
|
||||||
"""
|
"""
|
||||||
the faulty empty string repr did trigger
|
the faulty empty string repr did trigger
|
||||||
a unbound local error in _diff_text
|
an unbound local error in _diff_text
|
||||||
"""
|
"""
|
||||||
class A(str):
|
class A(str):
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
|
|
|
@ -998,7 +998,7 @@ class TestStdCapture(object):
|
||||||
reason='text output different for bytes on python3')
|
reason='text output different for bytes on python3')
|
||||||
def test_capturing_readouterr_decode_error_handling(self):
|
def test_capturing_readouterr_decode_error_handling(self):
|
||||||
with self.getcapture() as cap:
|
with self.getcapture() as cap:
|
||||||
# triggered a internal error in pytest
|
# triggered an internal error in pytest
|
||||||
print('\xa6')
|
print('\xa6')
|
||||||
out, err = cap.readouterr()
|
out, err = cap.readouterr()
|
||||||
assert out == py.builtin._totext('\ufffd\n', 'unicode-escape')
|
assert out == py.builtin._totext('\ufffd\n', 'unicode-escape')
|
||||||
|
|
|
@ -373,7 +373,7 @@ class TestConftestVisibility(object):
|
||||||
(None, 1, 1),
|
(None, 1, 1),
|
||||||
])
|
])
|
||||||
def test_search_conftest_up_to_inifile(testdir, confcutdir, passed, error):
|
def test_search_conftest_up_to_inifile(testdir, confcutdir, passed, error):
|
||||||
"""Test that conftest files are detected only up to a ini file, unless
|
"""Test that conftest files are detected only up to an ini file, unless
|
||||||
an explicit --confcutdir option is given.
|
an explicit --confcutdir option is given.
|
||||||
"""
|
"""
|
||||||
root = testdir.tmpdir
|
root = testdir.tmpdir
|
||||||
|
|
|
@ -289,7 +289,7 @@ def test_nose_setup_ordering(testdir):
|
||||||
|
|
||||||
|
|
||||||
def test_apiwrapper_problem_issue260(testdir):
|
def test_apiwrapper_problem_issue260(testdir):
|
||||||
# this would end up trying a call a optional teardown on the class
|
# this would end up trying a call an optional teardown on the class
|
||||||
# for plain unittests we dont want nose behaviour
|
# for plain unittests we dont want nose behaviour
|
||||||
testdir.makepyfile("""
|
testdir.makepyfile("""
|
||||||
import unittest
|
import unittest
|
||||||
|
|
Loading…
Reference in New Issue