Merge pull request #4554 from blueyed/merge-master

Merge master into features
This commit is contained in:
Daniel Hahler 2018-12-15 02:44:38 +01:00 committed by GitHub
commit 3cf44b3037
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 72 additions and 11 deletions

View File

@ -18,6 +18,31 @@ with advance notice in the **Deprecations** section of releases.
.. towncrier release notes start
pytest 4.0.2 (2018-12-13)
=========================
Bug Fixes
---------
- `#4265 <https://github.com/pytest-dev/pytest/issues/4265>`_: Validate arguments from the ``PYTEST_ADDOPTS`` environment variable and the ``addopts`` ini option separately.
- `#4435 <https://github.com/pytest-dev/pytest/issues/4435>`_: Fix ``raises(..., 'code(string)')`` frame filename.
- `#4500 <https://github.com/pytest-dev/pytest/issues/4500>`_: When a fixture yields and a log call is made after the test runs, and, if the test is interrupted, capture attributes are ``None``.
- `#4538 <https://github.com/pytest-dev/pytest/issues/4538>`_: Raise ``TypeError`` for ``with raises(..., match=<non-None falsey value>)``.
Improved Documentation
----------------------
- `#1495 <https://github.com/pytest-dev/pytest/issues/1495>`_: Document common doctest fixture directory tree structure pitfalls
pytest 4.0.1 (2018-11-23)
=========================

View File

@ -1 +0,0 @@
Document common doctest fixture directory tree structure pitfalls

View File

@ -1 +0,0 @@
Validate arguments from the ``PYTEST_ADDOPTS`` environment variable and the ``addopts`` ini option separately.

View File

@ -1 +0,0 @@
When a fixture yields and a log call is made after the test runs, and, if the test is interrupted, capture attributes are ``None``.

View File

@ -6,6 +6,7 @@ Release announcements
:maxdepth: 2
release-4.0.2
release-4.0.1
release-4.0.0
release-3.10.1

View File

@ -0,0 +1,24 @@
pytest-4.0.2
=======================================
pytest 4.0.2 has just been released to PyPI.
This is a bug-fix release, being a drop-in replacement. To upgrade::
pip install --upgrade pytest
The full changelog is available at https://docs.pytest.org/en/latest/changelog.html.
Thanks to all who contributed to this release, among them:
* Anthony Sottile
* Bruno Oliveira
* Daniel Hahler
* Pedro Algarvio
* Ronny Pfannschmidt
* Tomer Keren
* Yash Todi
Happy testing,
The pytest Development Team

View File

@ -538,7 +538,7 @@ Then run ``pytest`` with verbose mode and with only the ``basic`` marker:
$ pytest -v -m basic
=========================== test session starts ============================
platform linux -- Python 3.x.y, pytest-4.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python
platform linux -- Python 3.x.y, pytest-4.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.6
cachedir: .pytest_cache
rootdir: $REGENDOC_TMPDIR, inifile:
collecting ... collected 17 items / 14 deselected

View File

@ -718,6 +718,6 @@ class RaisesContext(object):
suppress_exception = issubclass(self.excinfo.type, self.expected_exception)
if sys.version_info[0] == 2 and suppress_exception:
sys.exc_clear()
if self.match_expr and suppress_exception:
if self.match_expr is not None and suppress_exception:
self.excinfo.match(self.match_expr)
return suppress_exception

View File

@ -44,6 +44,11 @@ class TestRaises(object):
except pytest.raises.Exception:
pass
def test_raises_falsey_type_error(self):
with pytest.raises(TypeError):
with pytest.raises(AssertionError, match=0):
raise AssertionError("ohai")
def test_raises_repr_inflight(self):
"""Ensure repr() on an exception info inside a pytest.raises with block works (#4386)"""

View File

@ -154,7 +154,8 @@ class TestImportHookInstallation(object):
@pytest.mark.parametrize("mode", ["plain", "rewrite"])
@pytest.mark.parametrize("plugin_state", ["development", "installed"])
def test_installed_plugin_rewrite(self, testdir, mode, plugin_state):
def test_installed_plugin_rewrite(self, testdir, mode, plugin_state, monkeypatch):
monkeypatch.delenv("PYTEST_DISABLE_PLUGIN_AUTOLOAD", raising=False)
# Make sure the hook is installed early enough so that plugins
# installed via setuptools are rewritten.
testdir.tmpdir.join("hampkg").ensure(dir=1)

View File

@ -511,6 +511,7 @@ def test_options_on_small_file_do_not_blow_up(testdir):
def test_preparse_ordering_with_setuptools(testdir, monkeypatch):
pkg_resources = pytest.importorskip("pkg_resources")
monkeypatch.delenv("PYTEST_DISABLE_PLUGIN_AUTOLOAD", raising=False)
def my_iter(name):
assert name == "pytest11"
@ -548,6 +549,7 @@ def test_preparse_ordering_with_setuptools(testdir, monkeypatch):
def test_setuptools_importerror_issue1479(testdir, monkeypatch):
pkg_resources = pytest.importorskip("pkg_resources")
monkeypatch.delenv("PYTEST_DISABLE_PLUGIN_AUTOLOAD", raising=False)
def my_iter(name):
assert name == "pytest11"
@ -576,6 +578,7 @@ def test_setuptools_importerror_issue1479(testdir, monkeypatch):
@pytest.mark.parametrize("block_it", [True, False])
def test_plugin_preparse_prevents_setuptools_loading(testdir, monkeypatch, block_it):
pkg_resources = pytest.importorskip("pkg_resources")
monkeypatch.delenv("PYTEST_DISABLE_PLUGIN_AUTOLOAD", raising=False)
plugin_module_placeholder = object()

View File

@ -1050,12 +1050,13 @@ def test_record_attribute(testdir):
)
def test_random_report_log_xdist(testdir):
def test_random_report_log_xdist(testdir, monkeypatch):
"""xdist calls pytest_runtest_logreport as they are executed by the slaves,
with nodes from several nodes overlapping, so junitxml must cope with that
to produce correct reports. #1064
"""
pytest.importorskip("xdist")
monkeypatch.delenv("PYTEST_DISABLE_PLUGIN_AUTOLOAD", raising=False)
testdir.makepyfile(
"""
import pytest, time

View File

@ -1341,13 +1341,15 @@ class TestProgressOutputStyle(object):
]
)
def test_xdist_normal(self, many_tests_files, testdir):
def test_xdist_normal(self, many_tests_files, testdir, monkeypatch):
pytest.importorskip("xdist")
monkeypatch.delenv("PYTEST_DISABLE_PLUGIN_AUTOLOAD", raising=False)
output = testdir.runpytest("-n2")
output.stdout.re_match_lines([r"\.{20} \s+ \[100%\]"])
def test_xdist_normal_count(self, many_tests_files, testdir):
def test_xdist_normal_count(self, many_tests_files, testdir, monkeypatch):
pytest.importorskip("xdist")
monkeypatch.delenv("PYTEST_DISABLE_PLUGIN_AUTOLOAD", raising=False)
testdir.makeini(
"""
[pytest]
@ -1357,8 +1359,9 @@ class TestProgressOutputStyle(object):
output = testdir.runpytest("-n2")
output.stdout.re_match_lines([r"\.{20} \s+ \[20/20\]"])
def test_xdist_verbose(self, many_tests_files, testdir):
def test_xdist_verbose(self, many_tests_files, testdir, monkeypatch):
pytest.importorskip("xdist")
monkeypatch.delenv("PYTEST_DISABLE_PLUGIN_AUTOLOAD", raising=False)
output = testdir.runpytest("-n2", "-v")
output.stdout.re_match_lines_random(
[
@ -1452,7 +1455,8 @@ class TestProgressWithTeardown(object):
]
)
def test_xdist_normal(self, many_files, testdir):
def test_xdist_normal(self, many_files, testdir, monkeypatch):
pytest.importorskip("xdist")
monkeypatch.delenv("PYTEST_DISABLE_PLUGIN_AUTOLOAD", raising=False)
output = testdir.runpytest("-n2")
output.stdout.re_match_lines([r"[\.E]{40} \s+ \[100%\]"])