When you don't get enough information with a test running on a CI, it's quite
frustrating, for various reasons:
- It's more likely to be a flaky test, so you might not be able to reproduce
the failure.
- Passing -vv is quite bothersome (creating a temporary commit and reverting
it)
For those reasons, if something goes wrong on CI, it's good to have as much
information as possible.
User provided messages, or any valid expression given as second
argument to the assert statement, are now shown in addition to the
py.test introspection details. Formerly any user provided message
would entirely replace the introspection details.
Fixes issue549.
The new "--tb=auto" option (default) will only display long tracebacks
for the first and last entry. You can get the old behaviour of printing
all entries as long entries with "--tb=long". Also short entries by
default are now printed very similarly to "--tb=native" ones.
The result from the pytest_assertrepr_compare hook should not include
any newlines since that will confuse the mini-formatting language used
by assertion.util.format_explanation. So simply escape the included
newlines, this way hook writers do not have to worry about this at
all.
Fixes issue 453.
If the compared text was in bytes and not actually valid text
(i.e. could not be encoded to text/unicode using the default encoding)
then the assertrepr would fail with an EncodingError. This ensures
that the internal string is always valid unicode, converting any bytes
safely to valid unicode. This is done using repr() which then needs
post-processing to fix the encompassing quotes and un-escape newlines.
This fixes issue 429.
This commit was slightly tricky because i want to backward
compatibility especially for the oejskit plugin which
uses Funcarg-filling for non-Function objects.
Before this was only done at the time the assertion plugin was loaded.
This lead to counter-intuitive behaviour where two subdirectories with
a pytest_assertrepr_compare hook in their conftest.py would not work,
only one would ever be used.
This defers assiging the _pytest.assertion.util._reprcompare function
until the item is loaded (pytest_runtest_setup) so that it can use the
hookrelay of the test item to find the appropriate
pytest_assertrepr_compare hook for the item.
This fixes issue #77.
Use load_module on the import hook to load the rewritten module. This allows the
removal of the complicated code related to copying pyc files in and out of the
cache location. It also plays more nicely with parallel py.test processes like
the ones found in xdist.