Skip to content

Release 3.10.0 #4297

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 64 commits into from
Nov 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
6610551
Restructured project.
nip3o Sep 26, 2015
1d23bef
Use a single node ID rather than a set for failed tests.
nip3o Sep 26, 2015
33f1ff4
Use result.stderr in tests since result.errlines has changed behaviour.
nip3o Sep 26, 2015
bd94954
pytest 2.7 compatibility.
nip3o Sep 26, 2015
d9c428c
add compat for pytest 3.7 and tox config for (some of) the versions i…
davidszotten Aug 1, 2018
c56d7ac
move files into the pytest file structure
davidszotten Oct 14, 2018
63c01d1
update for builtin plugin
davidszotten Oct 14, 2018
fd66f69
draft doc
davidszotten Oct 14, 2018
8c059db
draft changelog
davidszotten Oct 14, 2018
126bb07
authors
davidszotten Oct 14, 2018
4f652c9
we have a pr number now
davidszotten Oct 14, 2018
e773c8c
linting
davidszotten Oct 14, 2018
8187c14
now pinned to pytest version
davidszotten Oct 14, 2018
d67d189
grammar
davidszotten Oct 14, 2018
c25310d
fix cacheprovider test
davidszotten Oct 15, 2018
e478f66
cache is set by the cacheprovider
davidszotten Oct 17, 2018
f694d8d
Make --color more colorful
svenstaro Oct 18, 2018
43c3f59
Merge pull request #4188 from svenstaro/make-it-more-colorful
nicoddemus Oct 18, 2018
b432f12
Merge pull request #4190 from nicoddemus/merge-master-into-features
nicoddemus Oct 18, 2018
f947cb2
Merge remote-tracking branch 'upstream/features' into davidszotten/st…
nicoddemus Oct 20, 2018
7bb51b8
Issue a warning when a fixture named 'request' is collected
nicoddemus Oct 20, 2018
f30911d
Merge pull request #4209 from nicoddemus/fixture-named-request
crazymerlyn Oct 21, 2018
b51ee48
minor: remove unused _shutil_rmtree_remove_writable
blueyed Oct 23, 2018
2a45851
Merge pull request #4218 from blueyed/remove-_shutil_rmtree_remove_wr…
blueyed Oct 23, 2018
f8f4c16
TerminalWriter: write "collecting" msg only once every 0.1s
blueyed Oct 24, 2018
d40cd3e
Use functools.lru_cache with _getconftest_pathlist
blueyed Oct 24, 2018
e690e19
Merge pull request #4225 from blueyed/collect-performance
blueyed Oct 24, 2018
eee8201
Merge remote-tracking branch 'origin/master' into merge-master
blueyed Oct 24, 2018
66ce952
Merge pull request #4228 from blueyed/merge-master
blueyed Oct 24, 2018
1786ad1
functools.lru_cache does not exist on Python 2, apply for Python 3 only
nicoddemus Oct 24, 2018
65b97c2
Merge pull request #4227 from blueyed/_getconftest_pathlist-lru
RonnyPfannschmidt Oct 25, 2018
a4ea66c
pdb: resume capturing after `continue`
blueyed Jul 26, 2017
ede3a4e
pytest_{enter,leave}_pdb: pass through pdb instance
blueyed Oct 24, 2018
f466105
Merge pull request #2619 from blueyed/pdb-resume-capture
blueyed Oct 25, 2018
0dc6cb2
Move lru_cache wrapper to compat
blueyed Oct 25, 2018
6dc575f
Merge pull request #4239 from blueyed/lru_cache
blueyed Oct 25, 2018
e041823
Move handling of duplicate files
blueyed Oct 25, 2018
777e9e1
Merge remote-tracking branch 'origin/master' into merge-master
asottile Oct 26, 2018
bf19917
Merge pull request #4242 from pytest-dev/merge-master
RonnyPfannschmidt Oct 26, 2018
8d0e1a9
Merge pull request #4241 from blueyed/move-duplicates
nicoddemus Oct 26, 2018
dcdf86e
python: collect: revisit
blueyed Oct 26, 2018
e986d06
Merge pull request #4251 from blueyed/python-collect
nicoddemus Oct 27, 2018
9fe8710
Merge pull request #4147 from davidszotten/stepwise
RonnyPfannschmidt Oct 27, 2018
3b7fbcd
Merge remote-tracking branch 'upstream/master' into merge-master-into…
nicoddemus Oct 27, 2018
cc531a1
Merge pull request #4253 from nicoddemus/merge-master-into-features
RonnyPfannschmidt Oct 28, 2018
40228fc
collection: _recurse: skip __pycache__
blueyed Oct 25, 2018
233c2a2
Merge pull request #4250 from blueyed/ignore-pyc
nicoddemus Oct 30, 2018
1f1d4aa
cacheprovider: display cachedir also in non-verbose mode if customized
blueyed Oct 30, 2018
e0038b8
pdb: improve msg about output capturing with set_trace
blueyed Oct 31, 2018
65817dd
changelog [ci skip]
blueyed Oct 31, 2018
ce1cc3d
_getconftestmodules: use functools.lru_cache
blueyed Oct 24, 2018
017e504
Merge pull request #4277 from blueyed/pdb-set_trace-capture-msg
nicoddemus Nov 1, 2018
f8a2452
changelog [ci skip]
blueyed Nov 1, 2018
a192e6b
Merge pull request #4247 from blueyed/lru
blueyed Nov 1, 2018
f2cebce
Merge pull request #4272 from blueyed/cache-non-default
nicoddemus Nov 1, 2018
a41820f
collection: performance: use optimized parts function
boxed Oct 25, 2018
2b50911
Minor refactor for readability
boxed Oct 25, 2018
6ffa347
Handle dirs only once
blueyed Oct 25, 2018
023e1c7
paths: use set and isdisjoint
blueyed Oct 25, 2018
4cb838d
Merge pull request #4237 from boxed/master
nicoddemus Nov 3, 2018
6befdf8
Merge remote-tracking branch 'upstream/master' into release-3.10.0
nicoddemus Nov 3, 2018
1ec6805
Fix escape in code sample
nicoddemus Nov 3, 2018
c2e906e
Preparing release version 3.10.0
nicoddemus Nov 3, 2018
3d88d18
Fixed linting
nicoddemus Nov 3, 2018
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
3 changes: 3 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ Danielle Jenkins
Dave Hunt
David Díaz-Barquero
David Mohr
David Szotten
David Vierra
Daw-Ran Liou
Denis Kirisov
Expand Down Expand Up @@ -161,6 +162,7 @@ Miro Hrončok
Nathaniel Waisbrot
Ned Batchelder
Neven Mundar
Niclas Olofsson
Nicolas Delaby
Oleg Pidsadnyi
Oleg Sushchenko
Expand Down Expand Up @@ -202,6 +204,7 @@ Stefan Zimmermann
Stefano Taschini
Steffen Allner
Stephan Obermann
Sven-Hendrik Haase
Tadek Teleżyński
Tarcisio Fischer
Tareq Alayan
Expand Down
68 changes: 67 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,72 @@ with advance notice in the **Deprecations** section of releases.

.. towncrier release notes start

pytest 3.10.0 (2018-11-03)
==========================

Features
--------

- `#2619 <https://github.com/pytest-dev/pytest/issues/2619>`_: Resume capturing output after ``continue`` with ``__import__("pdb").set_trace()``.

This also adds a new ``pytest_leave_pdb`` hook, and passes in ``pdb`` to the
existing ``pytest_enter_pdb`` hook.


- `#4147 <https://github.com/pytest-dev/pytest/issues/4147>`_: Add ``-sw``, ``--stepwise`` as an alternative to ``--lf -x`` for stopping at the first failure, but starting the next test invocation from that test. See `the documentation <https://docs.pytest.org/en/latest/cache.html#stepwise>`__ for more info.


- `#4188 <https://github.com/pytest-dev/pytest/issues/4188>`_: Make ``--color`` emit colorful dots when not running in verbose mode. Earlier, it would only colorize the test-by-test output if ``--verbose`` was also passed.


- `#4225 <https://github.com/pytest-dev/pytest/issues/4225>`_: Improve performance with collection reporting in non-quiet mode with terminals.

The "collecting …" message is only printed/updated every 0.5s.



Bug Fixes
---------

- `#2701 <https://github.com/pytest-dev/pytest/issues/2701>`_: Fix false ``RemovedInPytest4Warning: usage of Session... is deprecated, please use pytest`` warnings.


- `#4046 <https://github.com/pytest-dev/pytest/issues/4046>`_: Fix problems with running tests in package ``__init__.py`` files.


- `#4260 <https://github.com/pytest-dev/pytest/issues/4260>`_: Swallow warnings during anonymous compilation of source.


- `#4262 <https://github.com/pytest-dev/pytest/issues/4262>`_: Fix access denied error when deleting stale directories created by ``tmpdir`` / ``tmp_path``.


- `#611 <https://github.com/pytest-dev/pytest/issues/611>`_: Naming a fixture ``request`` will now raise a warning: the ``request`` fixture is internal and
should not be overwritten as it will lead to internal errors.



Improved Documentation
----------------------

- `#4255 <https://github.com/pytest-dev/pytest/issues/4255>`_: Added missing documentation about the fact that module names passed to filter warnings are not regex-escaped.



Trivial/Internal Changes
------------------------

- `#4272 <https://github.com/pytest-dev/pytest/issues/4272>`_: Display cachedir also in non-verbose mode if non-default.


- `#4277 <https://github.com/pytest-dev/pytest/issues/4277>`_: pdb: improve message about output capturing with ``set_trace``.

Do not display "IO-capturing turned off/on" when ``-s`` is used to avoid
confusion.


- `#4279 <https://github.com/pytest-dev/pytest/issues/4279>`_: Improve message and stack level of warnings issued by ``monkeypatch.setenv`` when the value of the environment variable is not a ``str``.


pytest 3.9.3 (2018-10-27)
=========================

Expand Down Expand Up @@ -366,7 +432,7 @@ Features
the standard warnings filters to manage those warnings. This introduces ``PytestWarning``,
``PytestDeprecationWarning`` and ``RemovedInPytest4Warning`` warning types as part of the public API.

Consult `the documentation <https://docs.pytest.org/en/latest/warnings.html#internal-pytest-warnings>`_ for more info.
Consult `the documentation <https://docs.pytest.org/en/latest/warnings.html#internal-pytest-warnings>`__ for more info.


- `#2908 <https://github.com/pytest-dev/pytest/issues/2908>`_: ``DeprecationWarning`` and ``PendingDeprecationWarning`` are now shown by default if no other warning filter is
Expand Down
1 change: 0 additions & 1 deletion changelog/2701.bugfix.rst

This file was deleted.

1 change: 0 additions & 1 deletion changelog/4046.bugfix.rst

This file was deleted.

1 change: 0 additions & 1 deletion changelog/4255.doc.rst

This file was deleted.

1 change: 0 additions & 1 deletion changelog/4260.bugfix.rst

This file was deleted.

1 change: 0 additions & 1 deletion changelog/4262.bugfix.rst

This file was deleted.

1 change: 0 additions & 1 deletion changelog/4279.trivial.rst

This file was deleted.

1 change: 1 addition & 0 deletions doc/en/announce/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Release announcements
:maxdepth: 2


release-3.10.0
release-3.9.3
release-3.9.2
release-3.9.1
Expand Down
43 changes: 43 additions & 0 deletions doc/en/announce/release-3.10.0.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
pytest-3.10.0
=======================================

The pytest team is proud to announce the 3.10.0 release!

pytest is a mature Python testing tool with more than a 2000 tests
against itself, passing on many different interpreters and platforms.

This release contains a number of bugs fixes and improvements, so users are encouraged
to take a look at the CHANGELOG:

https://docs.pytest.org/en/latest/changelog.html

For complete documentation, please visit:

https://docs.pytest.org/en/latest/

As usual, you can upgrade from pypi via:

pip install -U pytest

Thanks to all who contributed to this release, among them:

* Anders Hovmöller
* Andreu Vallbona Plazas
* Ankit Goel
* Anthony Sottile
* Bernardo Gomes
* Brianna Laugher
* Bruno Oliveira
* Daniel Hahler
* David Szotten
* Mick Koch
* Niclas Olofsson
* Palash Chatterjee
* Ronny Pfannschmidt
* Sven-Hendrik Haase
* Ville Skyttä
* William Jamir Silva


Happy testing,
The Pytest Development Team
8 changes: 8 additions & 0 deletions doc/en/cache.rst
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,8 @@ You can always peek at the content of the cache using the
{'test_caching.py::test_function': True}
cache/nodeids contains:
['test_caching.py::test_function']
cache/stepwise contains:
[]
example/value contains:
42

Expand All @@ -260,3 +262,9 @@ by adding the ``--cache-clear`` option like this::
This is recommended for invocations from Continuous Integration
servers where isolation and correctness is more important
than speed.


Stepwise
--------

As an alternative to ``--lf -x``, especially for cases where you expect a large part of the test suite will fail, ``--sw``, ``--stepwise`` allows you to fix them one at a time. The test suite will run until the first failure and then stop. At the next invocation, tests will continue from the last failing test and then run until the next failing test. You may use the ``--stepwise-skip`` option to ignore one failing test and stop the test execution on the second failing test instead. This is useful if you get stuck on a failing test and just want to ignore it until later.
4 changes: 2 additions & 2 deletions doc/en/example/multipython.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def dumps(self, obj):
dumpfile = self.picklefile.dirpath("dump.py")
dumpfile.write(
textwrap.dedent(
r"""\
r"""
import pickle
f = open({!r}, 'wb')
s = pickle.dump({!r}, f, protocol=2)
Expand All @@ -49,7 +49,7 @@ def load_and_is_true(self, expression):
loadfile = self.picklefile.dirpath("load.py")
loadfile.write(
textwrap.dedent(
r"""\
r"""
import pickle
f = open({!r}, 'rb')
obj = pickle.load(f)
Expand Down
7 changes: 4 additions & 3 deletions doc/en/example/nonpython.rst
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,9 @@ interesting to just look at the collection tree::
rootdir: $REGENDOC_TMPDIR/nonpython, inifile:
collected 2 items
<Package '$REGENDOC_TMPDIR/nonpython'>
<YamlFile 'test_simple.yml'>
<YamlItem 'hello'>
<YamlItem 'ok'>
<Package '$REGENDOC_TMPDIR/nonpython'>
<YamlFile 'test_simple.yml'>
<YamlItem 'hello'>
<YamlItem 'ok'>

======================= no tests ran in 0.12 seconds =======================
14 changes: 1 addition & 13 deletions doc/en/writing_plugins.rst
Original file line number Diff line number Diff line change
Expand Up @@ -421,21 +421,9 @@ additionally it is possible to copy examples for an example folder before runnin
test_example.py::test_plugin
$REGENDOC_TMPDIR/test_example.py:4: PytestExperimentalApiWarning: testdir.copy_example is an experimental api that may change over time
testdir.copy_example("test_example.py")
$PYTHON_PREFIX/lib/python3.6/site-packages/_pytest/compat.py:332: RemovedInPytest4Warning: usage of Session.Class is deprecated, please use pytest.Class instead
return getattr(object, name, default)
$PYTHON_PREFIX/lib/python3.6/site-packages/_pytest/compat.py:332: RemovedInPytest4Warning: usage of Session.File is deprecated, please use pytest.File instead
return getattr(object, name, default)
$PYTHON_PREFIX/lib/python3.6/site-packages/_pytest/compat.py:332: RemovedInPytest4Warning: usage of Session.Function is deprecated, please use pytest.Function instead
return getattr(object, name, default)
$PYTHON_PREFIX/lib/python3.6/site-packages/_pytest/compat.py:332: RemovedInPytest4Warning: usage of Session.Instance is deprecated, please use pytest.Instance instead
return getattr(object, name, default)
$PYTHON_PREFIX/lib/python3.6/site-packages/_pytest/compat.py:332: RemovedInPytest4Warning: usage of Session.Item is deprecated, please use pytest.Item instead
return getattr(object, name, default)
$PYTHON_PREFIX/lib/python3.6/site-packages/_pytest/compat.py:332: RemovedInPytest4Warning: usage of Session.Module is deprecated, please use pytest.Module instead
return getattr(object, name, default)

-- Docs: https://docs.pytest.org/en/latest/warnings.html
=================== 2 passed, 7 warnings in 0.12 seconds ===================
=================== 2 passed, 1 warnings in 0.12 seconds ===================

For more information about the result object that ``runpytest()`` returns, and
the methods that it provides please check out the :py:class:`RunResult
Expand Down
3 changes: 2 additions & 1 deletion src/_pytest/cacheprovider.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,8 @@ def cache(request):


def pytest_report_header(config):
if config.option.verbose:
"""Display cachedir with --cache-show and if non-default."""
if config.option.verbose or config.getini("cache_dir") != ".pytest_cache":
cachedir = config.cache._cachedir
# TODO: evaluate generating upward relative paths
# starting with .., ../.. if sensible
Expand Down
3 changes: 3 additions & 0 deletions src/_pytest/capture.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ def _getcapture(self, method):

# Global capturing control

def is_globally_capturing(self):
return self._method != "no"

def start_global_capturing(self):
assert self._global_capturing is None
self._global_capturing = self._getcapture(self._method)
Expand Down
13 changes: 13 additions & 0 deletions src/_pytest/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,3 +428,16 @@ class FuncargnamesCompatAttr(object):
def funcargnames(self):
""" alias attribute for ``fixturenames`` for pre-2.3 compatibility"""
return self.fixturenames


if six.PY2:

def lru_cache(*_, **__):
def dec(fn):
return fn

return dec


else:
from functools import lru_cache # noqa: F401
54 changes: 30 additions & 24 deletions src/_pytest/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
from .findpaths import exists
from _pytest._code import ExceptionInfo
from _pytest._code import filter_traceback
from _pytest.compat import lru_cache
from _pytest.compat import safe_str
from _pytest.outcomes import Skipped

Expand Down Expand Up @@ -133,6 +134,7 @@ def directory_arg(path, optname):
"freeze_support",
"setuponly",
"setupplan",
"stepwise",
"warnings",
"logging",
)
Expand Down Expand Up @@ -212,7 +214,7 @@ def __init__(self):
self._conftest_plugins = set()

# state related to local conftest plugins
self._path2confmods = {}
self._dirpath2confmods = {}
self._conftestpath2mod = {}
self._confcutdir = None
self._noconftest = False
Expand Down Expand Up @@ -383,31 +385,35 @@ def _try_load_conftest(self, anchor):
if x.check(dir=1):
self._getconftestmodules(x)

@lru_cache(maxsize=128)
def _getconftestmodules(self, path):
if self._noconftest:
return []

try:
return self._path2confmods[path]
except KeyError:
if path.isfile():
directory = path.dirpath()
else:
directory = path
# XXX these days we may rather want to use config.rootdir
# and allow users to opt into looking into the rootdir parent
# directories instead of requiring to specify confcutdir
clist = []
for parent in directory.realpath().parts():
if self._confcutdir and self._confcutdir.relto(parent):
continue
conftestpath = parent.join("conftest.py")
if conftestpath.isfile():
mod = self._importconftest(conftestpath)
clist.append(mod)

self._path2confmods[path] = clist
return clist
if path.isfile():
directory = path.dirpath()
else:
directory = path

if six.PY2: # py2 is not using lru_cache.
try:
return self._dirpath2confmods[directory]
except KeyError:
pass

# XXX these days we may rather want to use config.rootdir
# and allow users to opt into looking into the rootdir parent
# directories instead of requiring to specify confcutdir
clist = []
for parent in directory.realpath().parts():
if self._confcutdir and self._confcutdir.relto(parent):
continue
conftestpath = parent.join("conftest.py")
if conftestpath.isfile():
mod = self._importconftest(conftestpath)
clist.append(mod)
self._dirpath2confmods[directory] = clist
return clist

def _rget_with_confmod(self, name, path):
modules = self._getconftestmodules(path)
Expand Down Expand Up @@ -448,8 +454,8 @@ def _importconftest(self, conftestpath):
self._conftest_plugins.add(mod)
self._conftestpath2mod[conftestpath] = mod
dirpath = conftestpath.dirpath()
if dirpath in self._path2confmods:
for path, mods in self._path2confmods.items():
if dirpath in self._dirpath2confmods:
for path, mods in self._dirpath2confmods.items():
if path and path.relto(dirpath) or path == dirpath:
assert mod not in mods
mods.append(mod)
Expand Down
Loading