diff --git a/.travis.yml b/.travis.yml index 03b502c80..750f93f81 100644 --- a/.travis.yml +++ b/.travis.yml @@ -86,6 +86,9 @@ jobs: - env: TOXENV=py36-xdist python: '3.6' - env: TOXENV=linting,docs,doctesting PYTEST_COVERAGE=1 + cache: + directories: + - $HOME/.cache/pre-commit - stage: deploy python: '3.6' @@ -144,7 +147,4 @@ notifications: skip_join: true email: - pytest-commit@python.org -cache: - directories: - - $HOME/.cache/pip - - $HOME/.cache/pre-commit +cache: false diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 9f98f6408..839b4c439 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -18,6 +18,28 @@ with advance notice in the **Deprecations** section of releases. .. towncrier release notes start +pytest 4.3.1 (2019-03-11) +========================= + +Bug Fixes +--------- + +- `#4810 `_: Logging messages inside ``pytest_runtest_logreport()`` are now properly captured and displayed. + + +- `#4861 `_: Improve validation of contents written to captured output so it behaves the same as when capture is disabled. + + +- `#4898 `_: Fix ``AttributeError: FixtureRequest has no 'confg' attribute`` bug in ``testdir.copy_example``. + + + +Trivial/Internal Changes +------------------------ + +- `#4768 `_: Avoid pkg_resources import at the top-level. + + pytest 4.3.0 (2019-02-16) ========================= diff --git a/changelog/4810.bugfix.rst b/changelog/4810.bugfix.rst deleted file mode 100644 index 32d9b97a5..000000000 --- a/changelog/4810.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Logging messages inside ``pytest_runtest_logreport()`` are now properly captured and displayed. diff --git a/changelog/4861.bugfix.rst b/changelog/4861.bugfix.rst deleted file mode 100644 index b4bf125d1..000000000 --- a/changelog/4861.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Improve validation of contents written to captured output so it behaves the same as when capture is disabled. diff --git a/changelog/4903.bugfix.rst b/changelog/4903.bugfix.rst new file mode 100644 index 000000000..116e1b0fd --- /dev/null +++ b/changelog/4903.bugfix.rst @@ -0,0 +1 @@ +Use the correct modified time for years after 2038 in rewritten ``.pyc`` files. diff --git a/changelog/4912.trivial.rst b/changelog/4912.trivial.rst new file mode 100644 index 000000000..9c5ca6d8e --- /dev/null +++ b/changelog/4912.trivial.rst @@ -0,0 +1 @@ +Remove deprecated Sphinx directive, ``add_description_unit()``. diff --git a/changelog/4913.trivial.rst b/changelog/4913.trivial.rst new file mode 100644 index 000000000..7846775cc --- /dev/null +++ b/changelog/4913.trivial.rst @@ -0,0 +1 @@ +Fix pytest tests invocation with custom ``PYTHONPATH``. diff --git a/doc/en/announce/index.rst b/doc/en/announce/index.rst index 9574229d0..96123f3fb 100644 --- a/doc/en/announce/index.rst +++ b/doc/en/announce/index.rst @@ -6,6 +6,7 @@ Release announcements :maxdepth: 2 + release-4.3.1 release-4.3.0 release-4.2.1 release-4.2.0 diff --git a/doc/en/announce/release-4.3.1.rst b/doc/en/announce/release-4.3.1.rst new file mode 100644 index 000000000..45d14fffe --- /dev/null +++ b/doc/en/announce/release-4.3.1.rst @@ -0,0 +1,29 @@ +pytest-4.3.1 +======================================= + +pytest 4.3.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: + +* Andras Mitzki +* Anthony Sottile +* Bruno Oliveira +* Daniel Hahler +* Danilo Horta +* Grygorii Iermolenko +* Jeff Hale +* Kyle Altendorf +* Stephan Hoyer +* Zac Hatfield-Dodds +* Zac-HD +* songbowen + + +Happy testing, +The pytest Development Team diff --git a/doc/en/conf.py b/doc/en/conf.py index 74a43596e..5daa15a06 100644 --- a/doc/en/conf.py +++ b/doc/en/conf.py @@ -335,7 +335,7 @@ intersphinx_mapping = {"python": ("https://docs.python.org/3", None)} def setup(app): # from sphinx.ext.autodoc import cut_lines # app.connect('autodoc-process-docstring', cut_lines(4, what=['module'])) - app.add_description_unit( + app.add_object_type( "confval", "confval", objname="configuration value", diff --git a/doc/en/example/parametrize.rst b/doc/en/example/parametrize.rst index 05932d164..b5d4693ad 100644 --- a/doc/en/example/parametrize.rst +++ b/doc/en/example/parametrize.rst @@ -436,8 +436,10 @@ Running it results in some skips if we don't have all the python interpreters in .. code-block:: pytest . $ pytest -rs -q multipython.py - ........................... [100%] - 27 passed in 0.12 seconds + ...sss...sssssssss...sss... [100%] + ========================= short test summary info ========================== + SKIPPED [15] $REGENDOC_TMPDIR/CWD/multipython.py:30: 'python3.4' not found + 12 passed, 15 skipped in 0.12 seconds Indirect parametrization of optional implementations/imports -------------------------------------------------------------------- diff --git a/doc/en/reference.rst b/doc/en/reference.rst index 7ab734075..ca1061a8f 100644 --- a/doc/en/reference.rst +++ b/doc/en/reference.rst @@ -584,6 +584,8 @@ Initialization hooks called for plugins and ``conftest.py`` files. .. autofunction:: pytest_sessionstart .. autofunction:: pytest_sessionfinish +.. autofunction:: pytest_plugin_registered + Test running hooks ~~~~~~~~~~~~~~~~~~ @@ -607,6 +609,8 @@ into interactive debugging when a test failure occurs. The :py:mod:`_pytest.terminal` reported specifically uses the reporting hook to print information about a test run. +.. autofunction:: pytest_pyfunc_call + Collection hooks ~~~~~~~~~~~~~~~~ @@ -616,6 +620,7 @@ Collection hooks .. autofunction:: pytest_ignore_collect .. autofunction:: pytest_collect_directory .. autofunction:: pytest_collect_file +.. autofunction:: pytest_pycollect_makemodule For influencing the collection of objects in Python modules you can use the following hook: @@ -629,12 +634,15 @@ items, delete or otherwise amend the test items: .. autofunction:: pytest_collection_modifyitems +.. autofunction:: pytest_collection_finish + Reporting hooks ~~~~~~~~~~~~~~~ Session related reporting hooks: .. autofunction:: pytest_collectstart +.. autofunction:: pytest_make_collect_report .. autofunction:: pytest_itemcollected .. autofunction:: pytest_collectreport .. autofunction:: pytest_deselected diff --git a/doc/en/requirements.txt b/doc/en/requirements.txt index 4e2b8ce1a..320ee8dcd 100644 --- a/doc/en/requirements.txt +++ b/doc/en/requirements.txt @@ -1,4 +1,4 @@ pygments-pytest>=1.1.0 -sphinx>=1.8.2 +sphinx>=1.8.2,<2.0 sphinxcontrib-trio sphinx-removed-in>=0.1.3 diff --git a/doc/en/tmpdir.rst b/doc/en/tmpdir.rst index e2b8fc32b..f16b9260c 100644 --- a/doc/en/tmpdir.rst +++ b/doc/en/tmpdir.rst @@ -66,7 +66,6 @@ Running this would result in a passed test except for the last test_tmp_path.py:13: AssertionError ========================= 1 failed in 0.12 seconds ========================= - .. _`tmp_path_factory example`: The ``tmp_path_factory`` fixture diff --git a/src/_pytest/assertion/rewrite.py b/src/_pytest/assertion/rewrite.py index 19192c9d9..18506d2e1 100644 --- a/src/_pytest/assertion/rewrite.py +++ b/src/_pytest/assertion/rewrite.py @@ -347,9 +347,11 @@ def _write_pyc(state, co, source_stat, pyc): try: with atomicwrites.atomic_write(pyc, mode="wb", overwrite=True) as fp: fp.write(imp.get_magic()) - mtime = int(source_stat.mtime) + # as of now, bytecode header expects 32-bit numbers for size and mtime (#4903) + mtime = int(source_stat.mtime) & 0xFFFFFFFF size = source_stat.size & 0xFFFFFFFF - fp.write(struct.pack("