Compare commits

...

7 Commits

Author SHA1 Message Date
pytest bot
92af2e22d2 Prepare release version 6.0.1 2020-07-30 11:50:12 +00:00
Ran Benita
0307213254 Merge pull request #7582 from bluetech/backport-7581
[6.0.x] Add missing changelog for issue 7569
2020-07-30 14:19:29 +03:00
Ran Benita
df7b26704d Merge pull request #7581 from bluetech/logging-setlevel-handler-restore
Add missing changelog for issue 7569

(cherry picked from commit 645cbc91fc)
2020-07-30 13:41:54 +03:00
Bruno Oliveira
1516780829 Merge pull request #7578 from nicoddemus/backport-7555
[6.0.x] Warn about --basetemp removing the entire directory (#7555)
2020-07-29 12:13:16 -03:00
Bruno Oliveira
b945b39b0b Merge pull request #7577 from nicoddemus/backport-7427
[6.0.x] Fix --help crash on add_ini(.., help='') and improve message on help=None (#7427)
2020-07-29 12:10:42 -03:00
Mattreex
2d5b8a85c2 Warn about --basetemp removing the entire directory (#7555)
Co-authored-by: mattreex <mattreex.9@gail.com>
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
(cherry picked from commit 1e66ed0b1c)
2020-07-29 11:58:52 -03:00
hp310780
8963644da3 Fix --help crash on add_ini(.., help='') and improve message on help=None (#7427) 2020-07-29 11:49:09 -03:00
9 changed files with 91 additions and 9 deletions

View File

@@ -1,2 +0,0 @@
Fix pylint ``not-callable`` lint on ``pytest.mark.parametrize()`` and the other builtin marks:
``skip``, ``skipif``, ``xfail``, ``usefixtures``, ``filterwarnings``.

View File

@@ -1 +0,0 @@
Fix regression in plugins using ``TestReport.longreprtext`` (such as ``pytest-html``) when ``TestReport.longrepr`` is not a string.

View File

@@ -6,6 +6,7 @@ Release announcements
:maxdepth: 2
release-6.0.1
release-6.0.0
release-6.0.0rc1
release-5.4.3

View File

@@ -0,0 +1,21 @@
pytest-6.0.1
=======================================
pytest 6.0.1 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:
* Bruno Oliveira
* Mattreex
* Ran Benita
* hp310780
Happy testing,
The pytest Development Team

View File

@@ -28,6 +28,26 @@ with advance notice in the **Deprecations** section of releases.
.. towncrier release notes start
pytest 6.0.1 (2020-07-30)
=========================
Bug Fixes
---------
- `#7394 <https://github.com/pytest-dev/pytest/issues/7394>`_: Passing an empty ``help`` value to ``Parser.add_option`` is now accepted instead of crashing when running ``pytest --help``.
Passing ``None`` raises a more informative ``TypeError``.
- `#7558 <https://github.com/pytest-dev/pytest/issues/7558>`_: Fix pylint ``not-callable`` lint on ``pytest.mark.parametrize()`` and the other builtin marks:
``skip``, ``skipif``, ``xfail``, ``usefixtures``, ``filterwarnings``.
- `#7559 <https://github.com/pytest-dev/pytest/issues/7559>`_: Fix regression in plugins using ``TestReport.longreprtext`` (such as ``pytest-html``) when ``TestReport.longrepr`` is not a string.
- `#7569 <https://github.com/pytest-dev/pytest/issues/7569>`_: Fix logging capture handler's level not reset on teardown after a call to ``caplog.set_level()``.
pytest 6.0.0 (2020-07-28)
=========================

View File

@@ -28,7 +28,7 @@ Install ``pytest``
.. code-block:: bash
$ pytest --version
pytest 6.0.0
pytest 6.0.1
.. _`simpletest`:

View File

@@ -192,8 +192,13 @@ You can override the default temporary directory setting like this:
pytest --basetemp=mydir
When distributing tests on the local machine, ``pytest`` takes care to
configure a basetemp directory for the sub processes such that all temporary
.. warning::
The contents of ``mydir`` will be completely removed, so make sure to use a directory
for that purpose only.
When distributing tests on the local machine using ``pytest-xdist``, care is taken to
automatically configure a basetemp directory for the sub processes such that all temporary
data lands below a single per-test run basetemp directory.
.. _`py.path.local`: https://py.readthedocs.io/en/latest/path.html

View File

@@ -170,6 +170,8 @@ def showhelp(config: Config) -> None:
help, type, default = config._parser._inidict[name]
if type is None:
type = "string"
if help is None:
raise TypeError("help argument cannot be None for {}".format(name))
spec = "{} ({}):".format(name, type)
tw.write(" %s" % spec)
spec_len = len(spec)
@@ -191,9 +193,10 @@ def showhelp(config: Config) -> None:
tw.write(" " * (indent_len - spec_len - 2))
wrapped = textwrap.wrap(help, columns - indent_len, break_on_hyphens=False)
tw.line(wrapped[0])
for line in wrapped[1:]:
tw.line(indent + line)
if wrapped:
tw.line(wrapped[0])
for line in wrapped[1:]:
tw.line(indent + line)
tw.line()
tw.line("environment variables:")

View File

@@ -38,6 +38,41 @@ def test_help(testdir):
)
def test_none_help_param_raises_exception(testdir):
"""Tests a None help param raises a TypeError.
"""
testdir.makeconftest(
"""
def pytest_addoption(parser):
parser.addini("test_ini", None, default=True, type="bool")
"""
)
result = testdir.runpytest("--help")
result.stderr.fnmatch_lines(
["*TypeError: help argument cannot be None for test_ini*"]
)
def test_empty_help_param(testdir):
"""Tests an empty help param is displayed correctly.
"""
testdir.makeconftest(
"""
def pytest_addoption(parser):
parser.addini("test_ini", "", default=True, type="bool")
"""
)
result = testdir.runpytest("--help")
assert result.ret == 0
lines = [
" required_plugins (args):",
" plugins that must be present for pytest to run*",
" test_ini (bool):*",
"environment variables:",
]
result.stdout.fnmatch_lines(lines, consecutive=True)
def test_hookvalidation_unknown(testdir):
testdir.makeconftest(
"""