Skip to content

2.8.1 release #1084

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 29, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,7 @@ Tom Viner
Trevor Bekolay
Wouter van Ackooy
David Díaz-Barquero
Eric Hunsberger
Simon Gomizelj
Russel Winder
Ben Webb
7 changes: 5 additions & 2 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
2.8.1.dev
---------
2.8.1
-----

- fix #1034: Add missing nodeid on pytest_logwarning call in
addhook. Thanks Simon Gomizelj for the PR.

- 'deprecated_call' is now only satisfied with a DeprecationWarning or
PendingDeprecationWarning. Before 2.8.0, it accepted any warning, and 2.8.0
Expand Down
12 changes: 3 additions & 9 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -209,19 +209,13 @@ but here is a simple overview:
are unsure about either of these steps, submit your pull request and we'll
help you fix it up.

#. Finally, submit a pull request through the GitHub website:

.. image:: doc/en/img/pullrequest.png
:width: 700px
:align: center

::
#. Finally, submit a pull request through the GitHub website using this data::

head-fork: YOUR_GITHUB_USERNAME/pytest
compare: your-branch-name

base-fork: pytest-dev/pytest
base: master # if it's a feature
base: pytest-VERSION # if it's a bugfix
base: master # if it's a bugfix
base: feature # if it's a feature


2 changes: 1 addition & 1 deletion _pytest/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#
__version__ = '2.8.1.dev1'
__version__ = '2.8.1'
14 changes: 14 additions & 0 deletions _pytest/pytester.py
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,20 @@ def syspathinsert(self, path=None):
if path is None:
path = self.tmpdir
sys.path.insert(0, str(path))
# a call to syspathinsert() usually means that the caller
# wants to import some dynamically created files.
# with python3 we thus invalidate import caches.
self._possibly_invalidate_import_caches()

def _possibly_invalidate_import_caches(self):
# invalidate caches if we can (py33 and above)
try:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cant we use from importlib import invalidate_caches to avoid the feature check in the else branch?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably -- but it's minor -- wouldn't want to repack/test everything for that.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or just do importlib.invalidate_caches() here and do except (ImportError, AttributeError): pass

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@The-Compiler nope ^^
edit
to clarify, i think the invalidate_caches call should not be protected by any kind of except clause

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ronny regards it as a matter of principle: if invalidate_caches() raises an AttributeError you would swallow it :)

import importlib
except ImportError:
pass
else:
if hasattr(importlib, "invalidate_caches"):
importlib.invalidate_caches()

def mkdir(self, name):
"""Create a new (sub)directory."""
Expand Down
4 changes: 2 additions & 2 deletions doc/en/assert.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ you will see the return value of the function call::

$ py.test test_assert1.py
======= test session starts ========
platform linux -- Python 3.4.2, pytest-2.8.1.dev1, py-1.4.30, pluggy-0.3.1
platform linux -- Python 3.4.3, pytest-2.8.1, py-1.4.30, pluggy-0.3.1
rootdir: $REGENDOC_TMPDIR, inifile:
collected 1 items

Expand Down Expand Up @@ -146,7 +146,7 @@ if you run this module::

$ py.test test_assert2.py
======= test session starts ========
platform linux -- Python 3.4.2, pytest-2.8.1.dev1, py-1.4.30, pluggy-0.3.1
platform linux -- Python 3.4.3, pytest-2.8.1, py-1.4.30, pluggy-0.3.1
rootdir: $REGENDOC_TMPDIR, inifile:
collected 1 items

Expand Down
6 changes: 3 additions & 3 deletions doc/en/cache.rst
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ If you then run it with ``--lf``::

$ py.test --lf
======= test session starts ========
platform linux -- Python 3.4.2, pytest-2.8.1.dev1, py-1.4.30, pluggy-0.3.1
platform linux -- Python 3.4.3, pytest-2.8.1, py-1.4.30, pluggy-0.3.1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to update this, just thought I would mention: next time we generate the examples I think (and Ronny agrees) that we should use Python 3.5 as a rule of thumb.

run-last-failure: rerun last 2 failures
rootdir: $REGENDOC_TMPDIR, inifile:
collected 50 items
Expand Down Expand Up @@ -114,7 +114,7 @@ of ``FF`` and dots)::

$ py.test --ff
======= test session starts ========
platform linux -- Python 3.4.2, pytest-2.8.1.dev1, py-1.4.30, pluggy-0.3.1
platform linux -- Python 3.4.3, pytest-2.8.1, py-1.4.30, pluggy-0.3.1
run-last-failure: rerun last 2 failures first
rootdir: $REGENDOC_TMPDIR, inifile:
collected 50 items
Expand Down Expand Up @@ -219,7 +219,7 @@ You can always peek at the content of the cache using the

$ py.test --cache-clear
======= test session starts ========
platform linux -- Python 3.4.2, pytest-2.8.1.dev1, py-1.4.30, pluggy-0.3.1
platform linux -- Python 3.4.3, pytest-2.8.1, py-1.4.30, pluggy-0.3.1
rootdir: $REGENDOC_TMPDIR, inifile:
collected 1 items

Expand Down
2 changes: 1 addition & 1 deletion doc/en/capture.rst
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ of the failing function and hide the other one::

$ py.test
======= test session starts ========
platform linux -- Python 3.4.2, pytest-2.8.1.dev1, py-1.4.30, pluggy-0.3.1
platform linux -- Python 3.4.3, pytest-2.8.1, py-1.4.30, pluggy-0.3.1
rootdir: $REGENDOC_TMPDIR, inifile:
collected 2 items

Expand Down
15 changes: 10 additions & 5 deletions doc/en/contents.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,16 @@ Full pytest documentation
contributing
plugins_index/index
talks
funcarg_compare
announce/index

.. toctree::
:hidden:
.. only:: html
.. toctree::

funcarg_compare
announce/index

.. only:: html
.. toctree::
:hidden:

changelog
changelog

2 changes: 1 addition & 1 deletion doc/en/doctest.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ then you can just invoke ``py.test`` without command line options::

$ py.test
======= test session starts ========
platform linux -- Python 3.4.2, pytest-2.8.1.dev1, py-1.4.30, pluggy-0.3.1
platform linux -- Python 3.4.3, pytest-2.8.1, py-1.4.30, pluggy-0.3.1
rootdir: $REGENDOC_TMPDIR, inifile: pytest.ini
collected 1 items

Expand Down
28 changes: 14 additions & 14 deletions doc/en/example/markers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ You can then restrict a test run to only run tests marked with ``webtest``::

$ py.test -v -m webtest
======= test session starts ========
platform linux -- Python 3.4.2, pytest-2.8.1.dev1, py-1.4.30, pluggy-0.3.1 -- $PYTHON_PREFIX/bin/python3.4
platform linux -- Python 3.4.3, pytest-2.8.1, py-1.4.30, pluggy-0.3.1 -- $PYTHON_PREFIX/bin/python3.4
cachedir: .cache
rootdir: $REGENDOC_TMPDIR, inifile:
collecting ... collected 4 items
Expand All @@ -45,7 +45,7 @@ Or the inverse, running all tests except the webtest ones::

$ py.test -v -m "not webtest"
======= test session starts ========
platform linux -- Python 3.4.2, pytest-2.8.1.dev1, py-1.4.30, pluggy-0.3.1 -- $PYTHON_PREFIX/bin/python3.4
platform linux -- Python 3.4.3, pytest-2.8.1, py-1.4.30, pluggy-0.3.1 -- $PYTHON_PREFIX/bin/python3.4
cachedir: .cache
rootdir: $REGENDOC_TMPDIR, inifile:
collecting ... collected 4 items
Expand All @@ -66,7 +66,7 @@ tests based on their module, class, method, or function name::

$ py.test -v test_server.py::TestClass::test_method
======= test session starts ========
platform linux -- Python 3.4.2, pytest-2.8.1.dev1, py-1.4.30, pluggy-0.3.1 -- $PYTHON_PREFIX/bin/python3.4
platform linux -- Python 3.4.3, pytest-2.8.1, py-1.4.30, pluggy-0.3.1 -- $PYTHON_PREFIX/bin/python3.4
cachedir: .cache
rootdir: $REGENDOC_TMPDIR, inifile:
collecting ... collected 5 items
Expand All @@ -79,7 +79,7 @@ You can also select on the class::

$ py.test -v test_server.py::TestClass
======= test session starts ========
platform linux -- Python 3.4.2, pytest-2.8.1.dev1, py-1.4.30, pluggy-0.3.1 -- $PYTHON_PREFIX/bin/python3.4
platform linux -- Python 3.4.3, pytest-2.8.1, py-1.4.30, pluggy-0.3.1 -- $PYTHON_PREFIX/bin/python3.4
cachedir: .cache
rootdir: $REGENDOC_TMPDIR, inifile:
collecting ... collected 4 items
Expand All @@ -92,7 +92,7 @@ Or select multiple nodes::

$ py.test -v test_server.py::TestClass test_server.py::test_send_http
======= test session starts ========
platform linux -- Python 3.4.2, pytest-2.8.1.dev1, py-1.4.30, pluggy-0.3.1 -- $PYTHON_PREFIX/bin/python3.4
platform linux -- Python 3.4.3, pytest-2.8.1, py-1.4.30, pluggy-0.3.1 -- $PYTHON_PREFIX/bin/python3.4
cachedir: .cache
rootdir: $REGENDOC_TMPDIR, inifile:
collecting ... collected 8 items
Expand Down Expand Up @@ -130,7 +130,7 @@ select tests based on their names::

$ py.test -v -k http # running with the above defined example module
======= test session starts ========
platform linux -- Python 3.4.2, pytest-2.8.1.dev1, py-1.4.30, pluggy-0.3.1 -- $PYTHON_PREFIX/bin/python3.4
platform linux -- Python 3.4.3, pytest-2.8.1, py-1.4.30, pluggy-0.3.1 -- $PYTHON_PREFIX/bin/python3.4
cachedir: .cache
rootdir: $REGENDOC_TMPDIR, inifile:
collecting ... collected 4 items
Expand All @@ -144,7 +144,7 @@ And you can also run all tests except the ones that match the keyword::

$ py.test -k "not send_http" -v
======= test session starts ========
platform linux -- Python 3.4.2, pytest-2.8.1.dev1, py-1.4.30, pluggy-0.3.1 -- $PYTHON_PREFIX/bin/python3.4
platform linux -- Python 3.4.3, pytest-2.8.1, py-1.4.30, pluggy-0.3.1 -- $PYTHON_PREFIX/bin/python3.4
cachedir: .cache
rootdir: $REGENDOC_TMPDIR, inifile:
collecting ... collected 4 items
Expand All @@ -160,7 +160,7 @@ Or to select "http" and "quick" tests::

$ py.test -k "http or quick" -v
======= test session starts ========
platform linux -- Python 3.4.2, pytest-2.8.1.dev1, py-1.4.30, pluggy-0.3.1 -- $PYTHON_PREFIX/bin/python3.4
platform linux -- Python 3.4.3, pytest-2.8.1, py-1.4.30, pluggy-0.3.1 -- $PYTHON_PREFIX/bin/python3.4
cachedir: .cache
rootdir: $REGENDOC_TMPDIR, inifile:
collecting ... collected 4 items
Expand Down Expand Up @@ -350,7 +350,7 @@ the test needs::

$ py.test -E stage2
======= test session starts ========
platform linux -- Python 3.4.2, pytest-2.8.1.dev1, py-1.4.30, pluggy-0.3.1
platform linux -- Python 3.4.3, pytest-2.8.1, py-1.4.30, pluggy-0.3.1
rootdir: $REGENDOC_TMPDIR, inifile:
collected 1 items

Expand All @@ -362,7 +362,7 @@ and here is one that specifies exactly the environment needed::

$ py.test -E stage1
======= test session starts ========
platform linux -- Python 3.4.2, pytest-2.8.1.dev1, py-1.4.30, pluggy-0.3.1
platform linux -- Python 3.4.3, pytest-2.8.1, py-1.4.30, pluggy-0.3.1
rootdir: $REGENDOC_TMPDIR, inifile:
collected 1 items

Expand Down Expand Up @@ -481,7 +481,7 @@ then you will see two test skipped and two executed tests as expected::

$ py.test -rs # this option reports skip reasons
======= test session starts ========
platform linux -- Python 3.4.2, pytest-2.8.1.dev1, py-1.4.30, pluggy-0.3.1
platform linux -- Python 3.4.3, pytest-2.8.1, py-1.4.30, pluggy-0.3.1
rootdir: $REGENDOC_TMPDIR, inifile:
collected 4 items

Expand All @@ -495,7 +495,7 @@ Note that if you specify a platform via the marker-command line option like this

$ py.test -m linux2
======= test session starts ========
platform linux -- Python 3.4.2, pytest-2.8.1.dev1, py-1.4.30, pluggy-0.3.1
platform linux -- Python 3.4.3, pytest-2.8.1, py-1.4.30, pluggy-0.3.1
rootdir: $REGENDOC_TMPDIR, inifile:
collected 4 items

Expand Down Expand Up @@ -547,7 +547,7 @@ We can now use the ``-m option`` to select one set::

$ py.test -m interface --tb=short
======= test session starts ========
platform linux -- Python 3.4.2, pytest-2.8.1.dev1, py-1.4.30, pluggy-0.3.1
platform linux -- Python 3.4.3, pytest-2.8.1, py-1.4.30, pluggy-0.3.1
rootdir: $REGENDOC_TMPDIR, inifile:
collected 4 items

Expand All @@ -569,7 +569,7 @@ or to select both "event" and "interface" tests::

$ py.test -m "interface or event" --tb=short
======= test session starts ========
platform linux -- Python 3.4.2, pytest-2.8.1.dev1, py-1.4.30, pluggy-0.3.1
platform linux -- Python 3.4.3, pytest-2.8.1, py-1.4.30, pluggy-0.3.1
rootdir: $REGENDOC_TMPDIR, inifile:
collected 4 items

Expand Down
12 changes: 6 additions & 6 deletions doc/en/example/nonpython.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ now execute the test specification::

nonpython $ py.test test_simple.yml
======= test session starts ========
platform linux -- Python 3.4.2, pytest-2.8.1.dev1, py-1.4.30, pluggy-0.3.1
platform linux -- Python 3.4.3, pytest-2.8.1, py-1.4.30, pluggy-0.3.1
rootdir: $REGENDOC_TMPDIR/nonpython, inifile:
collected 2 items

test_simple.yml .F
test_simple.yml F.

======= FAILURES ========
_______ usecase: hello ________
Expand Down Expand Up @@ -59,13 +59,13 @@ consulted when reporting in ``verbose`` mode::

nonpython $ py.test -v
======= test session starts ========
platform linux -- Python 3.4.2, pytest-2.8.1.dev1, py-1.4.30, pluggy-0.3.1 -- $PYTHON_PREFIX/bin/python3.4
platform linux -- Python 3.4.3, pytest-2.8.1, py-1.4.30, pluggy-0.3.1 -- $PYTHON_PREFIX/bin/python3.4
cachedir: .cache
rootdir: $REGENDOC_TMPDIR/nonpython, inifile:
collecting ... collected 2 items

test_simple.yml::ok PASSED
test_simple.yml::hello FAILED
test_simple.yml::ok PASSED

======= FAILURES ========
_______ usecase: hello ________
Expand All @@ -81,11 +81,11 @@ interesting to just look at the collection tree::

nonpython $ py.test --collect-only
======= test session starts ========
platform linux -- Python 3.4.2, pytest-2.8.1.dev1, py-1.4.30, pluggy-0.3.1
platform linux -- Python 3.4.3, pytest-2.8.1, py-1.4.30, pluggy-0.3.1
rootdir: $REGENDOC_TMPDIR/nonpython, inifile:
collected 2 items
<YamlFile 'test_simple.yml'>
<YamlItem 'ok'>
<YamlItem 'hello'>
<YamlItem 'ok'>

======= in 0.12 seconds ========
21 changes: 9 additions & 12 deletions doc/en/example/parametrize.rst
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ objects, they are still using the default pytest representation::

$ py.test test_time.py --collect-only
======= test session starts ========
platform linux -- Python 3.4.3, pytest-2.8.1.dev1, py-1.4.30, pluggy-0.3.1
platform linux -- Python 3.4.3, pytest-2.8.1, py-1.4.30, pluggy-0.3.1
rootdir: $REGENDOC_TMPDIR, inifile:
collected 6 items
<Module 'test_time.py'>
Expand Down Expand Up @@ -181,7 +181,7 @@ this is a fully self-contained example which you can run with::

$ py.test test_scenarios.py
======= test session starts ========
platform linux -- Python 3.4.2, pytest-2.8.1.dev1, py-1.4.30, pluggy-0.3.1
platform linux -- Python 3.4.3, pytest-2.8.1, py-1.4.30, pluggy-0.3.1
rootdir: $REGENDOC_TMPDIR, inifile:
collected 4 items

Expand All @@ -194,7 +194,7 @@ If you just collect tests you'll also nicely see 'advanced' and 'basic' as varia

$ py.test --collect-only test_scenarios.py
======= test session starts ========
platform linux -- Python 3.4.2, pytest-2.8.1.dev1, py-1.4.30, pluggy-0.3.1
platform linux -- Python 3.4.3, pytest-2.8.1, py-1.4.30, pluggy-0.3.1
rootdir: $REGENDOC_TMPDIR, inifile:
collected 4 items
<Module 'test_scenarios.py'>
Expand Down Expand Up @@ -259,7 +259,7 @@ Let's first see how it looks like at collection time::

$ py.test test_backends.py --collect-only
======= test session starts ========
platform linux -- Python 3.4.2, pytest-2.8.1.dev1, py-1.4.30, pluggy-0.3.1
platform linux -- Python 3.4.3, pytest-2.8.1, py-1.4.30, pluggy-0.3.1
rootdir: $REGENDOC_TMPDIR, inifile:
collected 2 items
<Module 'test_backends.py'>
Expand Down Expand Up @@ -320,7 +320,7 @@ The result of this test will be successful::

$ py.test test_indirect_list.py --collect-only
======= test session starts ========
platform linux -- Python 3.4.2, pytest-2.8.1.dev1, py-1.4.30, pluggy-0.3.1
platform linux -- Python 3.4.3, pytest-2.8.1, py-1.4.30, pluggy-0.3.1
rootdir: $REGENDOC_TMPDIR, inifile:
collected 1 items
<Module 'test_indirect_list.py'>
Expand Down Expand Up @@ -369,7 +369,7 @@ argument sets to use for each test function. Let's run it::
$ py.test -q
F..
======= FAILURES ========
_______ TestClass.test_equals[1-2] ________
_______ TestClass.test_equals[2-1] ________

self = <test_parametrize.TestClass object at 0xdeadbeef>, a = 1, b = 2

Expand Down Expand Up @@ -397,11 +397,8 @@ is to be run with different sets of arguments for its three arguments:
Running it results in some skips if we don't have all the python interpreters installed and otherwise runs all combinations (5 interpreters times 5 interpreters times 3 objects to serialize/deserialize)::

. $ py.test -rs -q multipython.py
ssssssssssss...ssssssssssss
======= short test summary info ========
SKIP [12] $REGENDOC_TMPDIR/CWD/multipython.py:22: 'python3.3' not found
SKIP [12] $REGENDOC_TMPDIR/CWD/multipython.py:22: 'python2.6' not found
3 passed, 24 skipped in 0.12 seconds
...........................
27 passed in 0.12 seconds

Indirect parametrization of optional implementations/imports
--------------------------------------------------------------------
Expand Down Expand Up @@ -448,7 +445,7 @@ If you run this with reporting for skips enabled::

$ py.test -rs test_module.py
======= test session starts ========
platform linux -- Python 3.4.2, pytest-2.8.1.dev1, py-1.4.30, pluggy-0.3.1
platform linux -- Python 3.4.3, pytest-2.8.1, py-1.4.30, pluggy-0.3.1
rootdir: $REGENDOC_TMPDIR, inifile:
collected 2 items

Expand Down
Loading