diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index cae90a428..635d8452f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -25,6 +25,10 @@ repos: rev: v1.2.0 hooks: - id: pyupgrade +- repo: https://github.com/pre-commit/pygrep-hooks + rev: v1.0.0 + hooks: + - id: rst-backticks - repo: local hooks: - id: rst @@ -34,8 +38,3 @@ repos: language: python additional_dependencies: [pygments, restructuredtext_lint] python_version: python3.6 - - id: rst-backticks - name: rst ``code`` is two backticks - entry: ' `[^`]+[^_]`([^_]|$)' - language: pygrep - types: [rst] diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 0c3bb2476..a6aa836df 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -8,7 +8,34 @@ .. towncrier release notes start -Pytest 3.6.3 (2018-07-04) +pytest 3.6.4 (2018-07-28) +========================= + +Bug Fixes +--------- + +- Invoke pytest using ``-mpytest`` so ``sys.path`` does not get polluted by packages installed in ``site-packages``. (`#742 `_) + + +Improved Documentation +---------------------- + +- Use ``smtp_connection`` instead of ``smtp`` in fixtures documentation to avoid possible confusion. (`#3592 `_) + + +Trivial/Internal Changes +------------------------ + +- Remove obsolete ``__future__`` imports. (`#2319 `_) + +- Add CITATION to provide information on how to formally cite pytest. (`#3402 `_) + +- Replace broken type annotations with type comments. (`#3635 `_) + +- Pin ``pluggy`` to ``<0.8``. (`#3727 `_) + + +pytest 3.6.3 (2018-07-04) ========================= Bug Fixes @@ -54,7 +81,7 @@ Trivial/Internal Changes `_) -Pytest 3.6.2 (2018-06-20) +pytest 3.6.2 (2018-06-20) ========================= Bug Fixes @@ -100,7 +127,7 @@ Trivial/Internal Changes `_) -Pytest 3.6.1 (2018-06-05) +pytest 3.6.1 (2018-06-05) ========================= Bug Fixes @@ -144,7 +171,7 @@ Trivial/Internal Changes `_) -Pytest 3.6.0 (2018-05-23) +pytest 3.6.0 (2018-05-23) ========================= Features @@ -230,7 +257,7 @@ Trivial/Internal Changes 3.7 or newer. (`#3497 `_) -Pytest 3.5.1 (2018-04-23) +pytest 3.5.1 (2018-04-23) ========================= @@ -282,7 +309,7 @@ Trivial/Internal Changes `_) -Pytest 3.5.0 (2018-03-21) +pytest 3.5.0 (2018-03-21) ========================= Deprecations and Removals @@ -434,7 +461,7 @@ Trivial/Internal Changes `_) -Pytest 3.4.2 (2018-03-04) +pytest 3.4.2 (2018-03-04) ========================= Bug Fixes @@ -471,7 +498,7 @@ Trivial/Internal Changes `_) -Pytest 3.4.1 (2018-02-20) +pytest 3.4.1 (2018-02-20) ========================= Bug Fixes @@ -532,7 +559,7 @@ Trivial/Internal Changes `_) -Pytest 3.4.0 (2018-01-30) +pytest 3.4.0 (2018-01-30) ========================= Deprecations and Removals @@ -664,7 +691,7 @@ Trivial/Internal Changes `_) -Pytest 3.3.2 (2017-12-25) +pytest 3.3.2 (2017-12-25) ========================= Bug Fixes @@ -701,7 +728,7 @@ Trivial/Internal Changes (`#3018 `_) -Pytest 3.3.1 (2017-12-05) +pytest 3.3.1 (2017-12-05) ========================= Bug Fixes @@ -743,13 +770,13 @@ Trivial/Internal Changes `_) -Pytest 3.3.0 (2017-11-23) +pytest 3.3.0 (2017-11-23) ========================= Deprecations and Removals ------------------------- -- Pytest no longer supports Python **2.6** and **3.3**. Those Python versions +- pytest no longer supports Python **2.6** and **3.3**. Those Python versions are EOL for some time now and incur maintenance and compatibility costs on the pytest core team, and following up with the rest of the community we decided that they will no longer be supported starting on this version. Users @@ -803,7 +830,7 @@ Features - Match ``warns`` signature to ``raises`` by adding ``match`` keyword. (`#2708 `_) -- Pytest now captures and displays output from the standard ``logging`` module. +- pytest now captures and displays output from the standard ``logging`` module. The user can control the logging level to be captured by specifying options in ``pytest.ini``, the command line and also during individual tests using markers. Also, a ``caplog`` fixture is available that enables users to test @@ -868,7 +895,7 @@ Bug Fixes avoids a number of potential problems. (`#2751 `_) -- Pytest no longer complains about warnings with unicode messages being +- pytest no longer complains about warnings with unicode messages being non-ascii compatible even for ascii-compatible messages. As a result of this, warnings with unicode messages are converted first to an ascii representation for safety. (`#2809 `_) @@ -920,7 +947,7 @@ Trivial/Internal Changes `_) -Pytest 3.2.5 (2017-11-15) +pytest 3.2.5 (2017-11-15) ========================= Bug Fixes @@ -931,7 +958,7 @@ Bug Fixes `_) -Pytest 3.2.4 (2017-11-13) +pytest 3.2.4 (2017-11-13) ========================= Bug Fixes @@ -980,7 +1007,7 @@ Improved Documentation `_) -Pytest 3.2.3 (2017-10-03) +pytest 3.2.3 (2017-10-03) ========================= Bug Fixes @@ -1020,7 +1047,7 @@ Trivial/Internal Changes (`#2765 `_) -Pytest 3.2.2 (2017-09-06) +pytest 3.2.2 (2017-09-06) ========================= Bug Fixes @@ -1067,7 +1094,7 @@ Trivial/Internal Changes `_) -Pytest 3.2.1 (2017-08-08) +pytest 3.2.1 (2017-08-08) ========================= Bug Fixes @@ -1097,7 +1124,7 @@ Improved Documentation `_) -Pytest 3.2.0 (2017-07-30) +pytest 3.2.0 (2017-07-30) ========================= Deprecations and Removals @@ -1263,7 +1290,7 @@ Trivial/Internal Changes `_) -Pytest 3.1.3 (2017-07-03) +pytest 3.1.3 (2017-07-03) ========================= Bug Fixes @@ -1309,7 +1336,7 @@ Trivial/Internal Changes (`#2499 `_) -Pytest 3.1.2 (2017-06-08) +pytest 3.1.2 (2017-06-08) ========================= Bug Fixes @@ -1341,7 +1368,7 @@ Improved Documentation and improve overall flow of the ``skipping`` docs. (#810) -Pytest 3.1.1 (2017-05-30) +pytest 3.1.1 (2017-05-30) ========================= Bug Fixes diff --git a/changelog/2319.trivial.rst b/changelog/2319.trivial.rst deleted file mode 100644 index a69ec1345..000000000 --- a/changelog/2319.trivial.rst +++ /dev/null @@ -1 +0,0 @@ -Remove obsolete ``__future__`` imports. diff --git a/changelog/3402.trivial.rst b/changelog/3402.trivial.rst deleted file mode 100644 index c5f340c85..000000000 --- a/changelog/3402.trivial.rst +++ /dev/null @@ -1 +0,0 @@ -Add CITATION to provide information on how to formally cite pytest. diff --git a/changelog/3592.doc.rst b/changelog/3592.doc.rst deleted file mode 100644 index 1d4d35352..000000000 --- a/changelog/3592.doc.rst +++ /dev/null @@ -1 +0,0 @@ -Use ``smtp_connection`` instead of ``smtp`` in fixtures documentation to avoid possible confusion. diff --git a/changelog/3635.trivial.rst b/changelog/3635.trivial.rst deleted file mode 100644 index 5354d0df9..000000000 --- a/changelog/3635.trivial.rst +++ /dev/null @@ -1 +0,0 @@ -Replace broken type annotations with type comments. diff --git a/changelog/742.bugfix.rst b/changelog/742.bugfix.rst deleted file mode 100644 index 51dfce972..000000000 --- a/changelog/742.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Invoke pytest using ``-mpytest`` so ``sys.path`` does not get polluted by packages installed in ``site-packages``. diff --git a/doc/en/announce/index.rst b/doc/en/announce/index.rst index 8283bf86d..42c3e4d61 100644 --- a/doc/en/announce/index.rst +++ b/doc/en/announce/index.rst @@ -6,6 +6,7 @@ Release announcements :maxdepth: 2 + release-3.6.4 release-3.6.3 release-3.6.2 release-3.6.1 diff --git a/doc/en/announce/release-3.6.4.rst b/doc/en/announce/release-3.6.4.rst new file mode 100644 index 000000000..fd6cff503 --- /dev/null +++ b/doc/en/announce/release-3.6.4.rst @@ -0,0 +1,24 @@ +pytest-3.6.4 +======================================= + +pytest 3.6.4 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 http://doc.pytest.org/en/latest/changelog.html. + +Thanks to all who contributed to this release, among them: + +* Anthony Sottile +* Bernhard M. Wiedemann +* Bruno Oliveira +* Drew +* E Hershey +* Hugo Martins +* Vlad Shcherbina + + +Happy testing, +The pytest Development Team diff --git a/doc/en/conf.py b/doc/en/conf.py index ebff6ff3b..5941716ab 100644 --- a/doc/en/conf.py +++ b/doc/en/conf.py @@ -65,7 +65,7 @@ master_doc = "contents" # General information about the project. project = u"pytest" year = datetime.datetime.utcnow().year -copyright = u"2015–{} , holger krekel and pytest-dev team".format(year) +copyright = u"2015–2018 , holger krekel and pytest-dev team" # The language for content autogenerated by Sphinx. Refer to documentation diff --git a/doc/en/customize.rst b/doc/en/customize.rst index c1a3498c7..2c9c070ad 100644 --- a/doc/en/customize.rst +++ b/doc/en/customize.rst @@ -139,7 +139,7 @@ line options while the environment is in use:: Here's how the command-line is built in the presence of ``addopts`` or the environment variable:: - $PYTEST_ADDOTPS + $PYTEST_ADDOPTS So if the user executes in the command-line:: diff --git a/doc/en/example/parametrize.rst b/doc/en/example/parametrize.rst index 882700fec..fdc802554 100644 --- a/doc/en/example/parametrize.rst +++ b/doc/en/example/parametrize.rst @@ -411,8 +411,10 @@ is to be run with different sets of arguments for its three arguments: Running it results in some skips if we don't have all the python interpreters installed and otherwise runs all combinations (5 interpreters times 5 interpreters times 3 objects to serialize/deserialize):: . $ pytest -rs -q multipython.py - ........................... [100%] - 27 passed in 0.12 seconds + ...sss...sssssssss...sss... [100%] + ========================= short test summary info ========================== + SKIP [15] $REGENDOC_TMPDIR/CWD/multipython.py:28: 'python3.4' not found + 12 passed, 15 skipped in 0.12 seconds Indirect parametrization of optional implementations/imports -------------------------------------------------------------------- diff --git a/doc/en/example/simple.rst b/doc/en/example/simple.rst index ed2c9d67a..180637ae9 100644 --- a/doc/en/example/simple.rst +++ b/doc/en/example/simple.rst @@ -416,7 +416,7 @@ Now we can profile which test functions execute the slowest:: ========================= slowest 3 test durations ========================= 0.30s call test_some_are_slow.py::test_funcslow2 0.20s call test_some_are_slow.py::test_funcslow1 - 0.13s call test_some_are_slow.py::test_funcfast + 0.10s call test_some_are_slow.py::test_funcfast ========================= 3 passed in 0.12 seconds ========================= incremental testing - test steps diff --git a/doc/en/fixture.rst b/doc/en/fixture.rst index 5e5cba452..d7a343f61 100644 --- a/doc/en/fixture.rst +++ b/doc/en/fixture.rst @@ -552,7 +552,7 @@ Parametrizing fixtures Fixture functions can be parametrized in which case they will be called multiple times, each time executing the set of dependent tests, i. e. the -tests that depend on this fixture. Test functions do usually not need +tests that depend on this fixture. Test functions usually do not need to be aware of their re-running. Fixture parametrization helps to write exhaustive functional tests for components which themselves can be configured in multiple ways. @@ -779,10 +779,10 @@ Here we declare an ``app`` fixture which receives the previously defined ========================= 2 passed in 0.12 seconds ========================= -Due to the parametrization of ``smtp_connection`` the test will run twice with two +Due to the parametrization of ``smtp_connection``, the test will run twice with two different ``App`` instances and respective smtp servers. There is no need for the ``app`` fixture to be aware of the ``smtp_connection`` -parametrization as pytest will fully analyse the fixture dependency graph. +parametrization because pytest will fully analyse the fixture dependency graph. Note, that the ``app`` fixture has a scope of ``module`` and uses a module-scoped ``smtp_connection`` fixture. The example would still work if @@ -805,7 +805,7 @@ first execute with one instance and then finalizers are called before the next fixture instance is created. Among other things, this eases testing of applications which create and use global state. -The following example uses two parametrized fixture, one of which is +The following example uses two parametrized fixtures, one of which is scoped on a per-module basis, and all the functions perform ``print`` calls to show the setup/teardown flow:: diff --git a/doc/en/mark.rst b/doc/en/mark.rst index c99768ce0..8f247afa9 100644 --- a/doc/en/mark.rst +++ b/doc/en/mark.rst @@ -57,15 +57,15 @@ Marker revamp and iteration .. versionadded:: 3.6 -pytest's marker implementation traditionally worked by simply updating the ``__dict__`` attribute of functions to add markers, in a cumulative manner. As a result of the this, markers would unintendely be passed along class hierarchies in surprising ways plus the API for retriving them was inconsistent, as markers from parameterization would be stored differently than markers applied using the ``@pytest.mark`` decorator and markers added via ``node.add_marker``. +pytest's marker implementation traditionally worked by simply updating the ``__dict__`` attribute of functions to cumulatively add markers. As a result, markers would unintentionally be passed along class hierarchies in surprising ways. Further, the API for retrieving them was inconsistent, as markers from parameterization would be stored differently than markers applied using the ``@pytest.mark`` decorator and markers added via ``node.add_marker``. This state of things made it technically next to impossible to use data from markers correctly without having a deep understanding of the internals, leading to subtle and hard to understand bugs in more advanced usages. Depending on how a marker got declared/changed one would get either a ``MarkerInfo`` which might contain markers from sibling classes, ``MarkDecorators`` when marks came from parameterization or from a ``node.add_marker`` call, discarding prior marks. Also ``MarkerInfo`` acts like a single mark, when it in fact represents a merged view on multiple marks with the same name. -On top of that markers where not accessible the same way for modules, classes, and functions/methods, -in fact, markers where only accessible in functions, even if they where declared on classes/modules. +On top of that markers were not accessible the same way for modules, classes, and functions/methods. +In fact, markers were only accessible in functions, even if they were declared on classes/modules. A new API to access markers has been introduced in pytest 3.6 in order to solve the problems with the initial design, providing :func:`_pytest.nodes.Node.iter_markers` method to iterate over markers in a consistent manner and reworking the internals, which solved great deal of problems with the initial design. @@ -83,7 +83,7 @@ In general there are two scenarios on how markers should be handled: 1. Marks overwrite each other. Order matters but you only want to think of your mark as a single item. E.g. ``log_level('info')`` at a module level can be overwritten by ``log_level('debug')`` for a specific test. - In this case replace use ``Node.get_closest_marker(name)``: + In this case, use ``Node.get_closest_marker(name)``: .. code-block:: python @@ -97,7 +97,7 @@ In general there are two scenarios on how markers should be handled: if marker: level = marker.args[0] -2. Marks compose additive. E.g. ``skipif(condition)`` marks means you just want to evaluate all of them, +2. Marks compose in an additive manner. E.g. ``skipif(condition)`` marks mean you just want to evaluate all of them, order doesn't even matter. You probably want to think of your marks as a set here. In this case iterate over each mark and handle their ``*args`` and ``**kwargs`` individually. @@ -127,27 +127,27 @@ Here is a non-exhaustive list of issues fixed by the new implementation: * Marks don't pick up nested classes (`#199 `_). -* markers stains on all related classes (`#568 `_). +* Markers stain on all related classes (`#568 `_). -* combining marks - args and kwargs calculation (`#2897 `_). +* Combining marks - args and kwargs calculation (`#2897 `_). * ``request.node.get_marker('name')`` returns ``None`` for markers applied in classes (`#902 `_). -* marks applied in parametrize are stored as markdecorator (`#2400 `_). +* Marks applied in parametrize are stored as markdecorator (`#2400 `_). -* fix marker interaction in a backward incompatible way (`#1670 `_). +* Fix marker interaction in a backward incompatible way (`#1670 `_). * Refactor marks to get rid of the current "marks transfer" mechanism (`#2363 `_). * Introduce FunctionDefinition node, use it in generate_tests (`#2522 `_). -* remove named marker attributes and collect markers in items (`#891 `_). +* Remove named marker attributes and collect markers in items (`#891 `_). * skipif mark from parametrize hides module level skipif mark (`#1540 `_). * skipif + parametrize not skipping tests (`#1296 `_). -* marker transfer incompatible with inheritance (`#535 `_). +* Marker transfer incompatible with inheritance (`#535 `_). More details can be found in the `original PR `_. diff --git a/doc/en/reference.rst b/doc/en/reference.rst index b65e15822..86d92cf07 100644 --- a/doc/en/reference.rst +++ b/doc/en/reference.rst @@ -787,7 +787,7 @@ TestReport _Result ~~~~~~~ -.. autoclass:: pluggy._Result +.. autoclass:: pluggy.callers._Result :members: Special Variables diff --git a/pyproject.toml b/pyproject.toml index 65e6bf59b..b1e85601e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,6 +10,7 @@ package = "pytest" package_dir = "src" filename = "CHANGELOG.rst" directory = "changelog/" +title_format = "pytest {version} ({project_date})" template = "changelog/_template.rst" [[tool.towncrier.type]] diff --git a/setup.py b/setup.py index 9720b6f48..b76825aff 100644 --- a/setup.py +++ b/setup.py @@ -69,7 +69,7 @@ def main(): # if _PYTEST_SETUP_SKIP_PLUGGY_DEP is set, skip installing pluggy; # used by tox.ini to test with pluggy master if "_PYTEST_SETUP_SKIP_PLUGGY_DEP" not in os.environ: - install_requires.append("pluggy>=0.5,<0.7") + install_requires.append("pluggy>=0.5,<0.8") environment_marker_support_level = get_environment_marker_support_level() if environment_marker_support_level >= 2: install_requires.append('funcsigs;python_version<"3.0"')