Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
71ad5b0
remove cancelled training sidebar
obestwalter Oct 10, 2019
bad4ffc
remove cancelled training sidebar (#5938)
nicoddemus Oct 10, 2019
57141dc
Add link to technical aspects issue to the py27-py34 docs
nicoddemus Oct 11, 2019
b162ab6
Merge pull request #5943 from nicoddemus/py2-py37-tech-docs
asottile Oct 11, 2019
d07c5ba
Update pdb++ link (moved to GitHub)
attomos Oct 12, 2019
83ba5eb
Add pudb to project examples
attomos Oct 12, 2019
1f639e2
Casting fixture parameter to list at the beginning of parameter parsing.
Oct 12, 2019
122748a
Added changelog file.
Oct 12, 2019
63e3d89
Fixed linting.
Oct 12, 2019
122cf60
Always creating list for consistency.
Sup3rGeo Oct 12, 2019
4f2abd7
Merge pull request #5948 from attomos/update-projects-doc
The-Compiler Oct 12, 2019
7678f89
Workaround curl bug which makes retries of fetching codecov.io/bash n…
bluetech Oct 12, 2019
3322c1e
Casting fixture parameter to list at the beginning of parameter… (#5950)
nicoddemus Oct 12, 2019
1555973
Workaround curl bug which makes retries of fetching codecov.io/… (#5951)
nicoddemus Oct 12, 2019
ae94652
Port CHANGELOG from 4.6.6 release
nicoddemus Oct 13, 2019
a20880c
Merge pull request #5952 from nicoddemus/port-changelog
asottile Oct 13, 2019
dee8d94
changelog: #5523 was fixed in 5.0.1 already
blueyed Oct 14, 2019
7bc8cb8
Merge pull request #5954 from blueyed/changelog-remove-dupe
asottile Oct 14, 2019
71a7fd0
doc: caplog: add caplog.messages
blueyed Oct 15, 2019
76c2a8e
doc: caplog: add caplog.messages (#5963)
nicoddemus Oct 15, 2019
0383d43
Add missing version added/changed markers to docs
nicoddemus Oct 15, 2019
77a995f
Add missing version added/changed markers to docs (#5966)
nicoddemus Oct 16, 2019
90dfee5
tests: keep numpy being optional
blueyed Oct 16, 2019
3cb1457
Merge pull request #5977 from blueyed/numpy
nicoddemus Oct 16, 2019
a73d015
ci: Travis: move py37-pexpect to another job
blueyed Oct 16, 2019
ce8b1df
ci: Travis: move py37-pexpect to another job (#5979)
blueyed Oct 17, 2019
f2dd9cc
Remove redundant mention from 5.2.0 release notes.
aklajnert Oct 17, 2019
813ef9e
Merge pull request #5983 from aklajnert/fix_5.2.0_announce
blueyed Oct 17, 2019
7ef4491
tests: debugging: disable pdb++ within inner tests
blueyed Oct 18, 2019
6b2bae9
tests: filterwarnings: do not crash with "(rm_rf)" warning
blueyed Oct 18, 2019
d910175
Merge pull request #5993 from blueyed/filterwarnings-error-removing
blueyed Oct 18, 2019
0783030
Merge pull request #5992 from blueyed/tests-PDBPP_HIJACK_PDB
blueyed Oct 18, 2019
0976e2f
Merge master into features
blueyed Oct 18, 2019
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
7 changes: 3 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ jobs:
- test $(python -c 'import sys; print("%d%d" % sys.version_info[0:2])') = 37

# Full run of latest supported version, without xdist.
- env: TOXENV=py37
# Coverage for:
# - test_sys_breakpoint_interception (via pexpect).
- env: TOXENV=py37-pexpect PYTEST_COVERAGE=1
python: '3.7'

# Coverage tracking is slow with pypy, skip it.
Expand All @@ -54,9 +56,6 @@ jobs:
- env: TOXENV=py37-lsof-oldattrs-numpy-twisted-xdist PYTEST_COVERAGE=1 PYTEST_ADDOPTS=

# Specialized factors for py37.
# Coverage for:
# - test_sys_breakpoint_interception (via pexpect).
- env: TOXENV=py37-pexpect PYTEST_COVERAGE=1
- env: TOXENV=py37-pluggymaster-xdist
- env: TOXENV=py37-freeze

Expand Down
30 changes: 27 additions & 3 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,33 @@ Bug Fixes
- `#5902 <https://github.com/pytest-dev/pytest/issues/5902>`_: Fix warnings about deprecated ``cmp`` attribute in ``attrs>=19.2``.


pytest 4.6.6 (2019-10-11)
=========================

Bug Fixes
---------

- `#5523 <https://github.com/pytest-dev/pytest/issues/5523>`_: Fixed using multiple short options together in the command-line (for example ``-vs``) in Python 3.8+.


- `#5537 <https://github.com/pytest-dev/pytest/issues/5537>`_: Replace ``importlib_metadata`` backport with ``importlib.metadata`` from the
standard library on Python 3.8+.


- `#5806 <https://github.com/pytest-dev/pytest/issues/5806>`_: Fix "lexer" being used when uploading to bpaste.net from ``--pastebin`` to "text".


- `#5902 <https://github.com/pytest-dev/pytest/issues/5902>`_: Fix warnings about deprecated ``cmp`` attribute in ``attrs>=19.2``.



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

- `#5801 <https://github.com/pytest-dev/pytest/issues/5801>`_: Fixes python version checks (detected by ``flake8-2020``) in case python4 becomes a thing.



pytest 5.2.0 (2019-09-28)
=========================

Expand Down Expand Up @@ -214,9 +241,6 @@ Bug Fixes
- `#5477 <https://github.com/pytest-dev/pytest/issues/5477>`_: The XML file produced by ``--junitxml`` now correctly contain a ``<testsuites>`` root element.


- `#5523 <https://github.com/pytest-dev/pytest/issues/5523>`_: Fixed using multiple short options together in the command-line (for example ``-vs``) in Python 3.8+.


- `#5524 <https://github.com/pytest-dev/pytest/issues/5524>`_: Fix issue where ``tmp_path`` and ``tmpdir`` would not remove directories containing files marked as read-only,
which could lead to pytest crashing when executed a second time with the ``--basetemp`` option.

Expand Down
1 change: 1 addition & 0 deletions changelog/5946.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed issue when parametrizing fixtures with numpy arrays (and possibly other sequence-like types).
1 change: 0 additions & 1 deletion doc/en/announce/release-5.2.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ Thanks to all who contributed to this release, among them:
* Michael Goerz
* Ran Benita
* Tomáš Chvátal
* aklajnert


Happy testing,
Expand Down
2 changes: 2 additions & 0 deletions doc/en/doctest.rst
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ pytest also introduces new options:
a string! This means that it may not be appropriate to enable globally in
``doctest_optionflags`` in your configuration file.

.. versionadded:: 5.1


Continue on failure
-------------------
Expand Down
4 changes: 4 additions & 0 deletions doc/en/fixture.rst
Original file line number Diff line number Diff line change
Expand Up @@ -301,9 +301,13 @@ are finalized when the last test of a *package* finishes.
Use this new feature sparingly and please make sure to report any issues you find.


.. _dynamic scope:

Dynamic scope
^^^^^^^^^^^^^

.. versionadded:: 5.2

In some cases, you might want to change the scope of the fixture without changing the code.
To do that, pass a callable to ``scope``. The callable must return a string with a valid scope
and will be executed only once - during the fixture definition. It will be called with two
Expand Down
3 changes: 2 additions & 1 deletion doc/en/projects.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ Here are some examples of projects using ``pytest`` (please send notes via :ref:
* `execnet <http://codespeak.net/execnet>`_ rapid multi-Python deployment
* `pylib <https://pylib.readthedocs.io/en/stable/>`_ cross-platform path, IO, dynamic code library
* `bbfreeze <https://pypi.org/project/bbfreeze/>`_ create standalone executables from Python scripts
* `pdb++ <http://bitbucket.org/antocuni/pdb>`_ a fancier version of PDB
* `pdb++ <https://github.com/pdbpp/pdbpp>`_ a fancier version of PDB
* `pudb <https://github.com/inducer/pudb>`_ full-screen console debugger for python
* `py-s3fuse <http://code.google.com/p/py-s3fuse/>`_ Amazon S3 FUSE based filesystem
* `waskr <http://code.google.com/p/waskr/>`_ WSGI Stats Middleware
* `guachi <http://code.google.com/p/guachi/>`_ global persistent configs for Python modules
Expand Down
5 changes: 5 additions & 0 deletions doc/en/py27-py34-deprecation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,8 @@ branch will continue to exist so the community itself can contribute patches. Th
be happy to accept those patches and make new ``4.6`` releases **until mid-2020**.

.. _`python_requires`: https://packaging.python.org/guides/distributing-packages-using-setuptools/#python-requires

Technical Aspects
-----------------

The technical aspects of the Python 2.7 and 3.4 support plan (such as when releases will occurr, how to backport fixes, etc) is described in issue `#5275 <https://github.com/pytest-dev/pytest/issues/5275>`__.
4 changes: 0 additions & 4 deletions doc/en/talks.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
Talks and Tutorials
==========================

.. sidebar:: Next Open Trainings

- `3 day hands-on workshop covering pytest, tox and devpi: "Professional Testing with Python" <https://python-academy.com/courses/specialtopics/python_course_testing.html>`_ (English), October 21 - 23, 2019, Leipzig, Germany.

.. _`funcargs`: funcargs.html

Books
Expand Down
5 changes: 5 additions & 0 deletions doc/en/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -718,6 +718,11 @@ for example ``-x`` if you only want to send one particular failure.

Currently only pasting to the http://bpaste.net service is implemented.

.. versionchanged:: 5.2

If creating the URL fails for any reason, a warning is generated instead of failing the
entire test suite.

Early loading plugins
---------------------

Expand Down
3 changes: 2 additions & 1 deletion scripts/report-coverage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ fi
python -m coverage combine
python -m coverage xml
python -m coverage report -m
curl -S -L --retry 6 -s https://codecov.io/bash -o codecov-upload.sh
# Set --connect-timeout to work around https://github.com/curl/curl/issues/4461
curl -S -L --connect-timeout 5 --retry 6 -s https://codecov.io/bash -o codecov-upload.sh
bash codecov-upload.sh -Z -X fix -f coverage.xml
2 changes: 2 additions & 0 deletions src/_pytest/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,8 @@ class Config:
class InvocationParams:
"""Holds parameters passed during ``pytest.main()``

.. versionadded:: 5.1

.. note::

Currently the environment variable PYTEST_ADDOPTS is also handled by
Expand Down
13 changes: 9 additions & 4 deletions src/_pytest/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -1088,9 +1088,13 @@ def fixture(

:arg scope: the scope for which this fixture is shared, one of
``"function"`` (default), ``"class"``, ``"module"``,
``"package"`` or ``"session"``.
``"package"`` or ``"session"`` (``"package"`` is considered **experimental**
at this time).

``"package"`` is considered **experimental** at this time.
This parameter may also be a callable which receives ``(fixture_name, config)``
as parameters, and must return a ``str`` with one of the values mentioned above.

See :ref:`dynamic scope` in the docs for more information.

:arg params: an optional list of parameters which will cause multiple
invocations of the fixture function and all of the tests
Expand All @@ -1113,6 +1117,9 @@ def fixture(
``fixture_<fixturename>`` and then use
``@pytest.fixture(name='<fixturename>')``.
"""
if params is not None:
params = list(params)

fixture_function, arguments = _parse_fixture_args(
callable_or_scope,
*args,
Expand All @@ -1134,8 +1141,6 @@ def fixture(
fixture_function
)

if params is not None and not isinstance(params, (list, tuple)):
params = list(params)
return FixtureFunctionMarker(scope, params, autouse, ids=ids, name=name)


Expand Down
2 changes: 2 additions & 0 deletions src/_pytest/hookspec.py
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,8 @@ def pytest_assertion_pass(item, lineno, orig, expl):
"""
**(Experimental)**

.. versionadded:: 5.0

Hook called whenever an assertion *passes*.

Use this hook to do some processing after a passing assertion.
Expand Down
1 change: 1 addition & 0 deletions src/_pytest/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,7 @@ def caplog(request):

Captured logs are available through the following properties/methods::

* caplog.messages -> list of format-interpolated log messages
* caplog.text -> string containing formatted log output
* caplog.records -> list of logging.LogRecord instances
* caplog.record_tuples -> list of (logger_name, level, message) tuples
Expand Down
2 changes: 2 additions & 0 deletions src/_pytest/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

class ExitCode(enum.IntEnum):
"""
.. versionadded:: 5.0

Encodes the valid exit codes by pytest.

Currently users and plugins may supply other exit codes as well.
Expand Down
20 changes: 20 additions & 0 deletions testing/python/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -4187,3 +4187,23 @@ def test_check_fixture_instantiations():
)
result = testdir.runpytest()
result.assert_outcomes(passed=7)


def test_fixture_parametrization_nparray(testdir):
pytest.importorskip("numpy")

testdir.makepyfile(
"""
from numpy import linspace
from pytest import fixture

@fixture(params=linspace(1, 10, 10))
def value(request):
return request.param

def test_bug(value):
assert value == value
"""
)
result = testdir.runpytest()
result.assert_outcomes(passed=10)
8 changes: 8 additions & 0 deletions testing/test_pdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@
_ENVIRON_PYTHONBREAKPOINT = os.environ.get("PYTHONBREAKPOINT", "")


@pytest.fixture(autouse=True)
def pdb_env(request):
if "testdir" in request.fixturenames:
# Disable pdb++ with inner tests.
testdir = request.getfixturevalue("testdir")
testdir._env_run_update["PDBPP_HIJACK_PDB"] = "0"


def runpdb_and_get_report(testdir, source):
p = testdir.makepyfile(source)
result = testdir.runpytest_inprocess("--pdb", p)
Expand Down
2 changes: 2 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ filterwarnings =
error
default:Using or importing the ABCs:DeprecationWarning:unittest2.*
ignore:Module already imported so cannot be rewritten:pytest.PytestWarning
# https://github.com/pytest-dev/pytest/issues/5974
default:\(rm_rf\) error removing.*:pytest.PytestWarning
# produced by python3.6/site.py itself (3.6.7 on Travis, could not trigger it with 3.6.8).
ignore:.*U.*mode is deprecated:DeprecationWarning:(?!(pytest|_pytest))
# produced by pytest-xdist
Expand Down