Skip to content

Merge master into features #6259

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 28 commits into from
Nov 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
1cecdf6
Added checklinks to tox and release.py
steffenschroeder Jul 13, 2019
ceeb7bd
Fixed broken links
steffenschroeder Aug 27, 2019
36ef545
Improve instructions on how to write CHANGELOG entries
nicoddemus Nov 19, 2019
688bbef
Improve instructions on how to write CHANGELOG entries (#6235)
nicoddemus Nov 19, 2019
7e5ad31
Merge features into master after 5.3 (#6236)
nicoddemus Nov 19, 2019
2228ccb
pytester: reset log output in _match_lines (#70)
blueyed Nov 3, 2019
8c65eae
Fix rendering of Before/After in changelog
asottile Nov 20, 2019
af9dfc6
Introduce 5934 in CHANGELOG and fix "pytest" blocks
nicoddemus Nov 20, 2019
fe69a2c
Delete 5934.feature.rst included in the wrong folder by accident
nicoddemus Nov 20, 2019
2879d25
Fix rendering of Before/After in changelog (#6238)
nicoddemus Nov 20, 2019
58ec5be
Merge pull request #6237 from blueyed/fix-no_fnmatch_line
blueyed Nov 20, 2019
be72265
docs: configure default_role=literal
blueyed Nov 20, 2019
b96e0a7
pytester: LineMatcher: __tracebackhide__ with _fail
blueyed Nov 21, 2019
4ee984f
Merge pull request #6250 from blueyed/tbh
blueyed Nov 21, 2019
6659fe0
CHANGELOG: two minor fixes/improvements
blueyed Nov 21, 2019
7e10c81
Added link checking to tox and release.py (#5614)
Zac-HD Nov 21, 2019
64eb9ea
Modify test for new expected behaviour
mdickinson Nov 21, 2019
8f2fd8f
Add develop instructions to CONTRIBUTING
nicoddemus Nov 20, 2019
2ffbe41
clear sys.last_traceback via del instead of = None
mdickinson Nov 21, 2019
490c7c7
Add develop instructions to CONTRIBUTING (#6249)
nicoddemus Nov 21, 2019
9d1082b
Add changelog file.
mdickinson Nov 21, 2019
8d686a8
Add self to AUTHORS
mdickinson Nov 21, 2019
dbb8c14
Use proper reST attribute markup.
mdickinson Nov 21, 2019
82424c9
Fix reST markup.
mdickinson Nov 21, 2019
f1ac0ee
Remove sys.last_traceback attribute using del instead of settin… (#6256)
nicoddemus Nov 21, 2019
8b7aeef
Merge pull request #6248 from blueyed/default-role
blueyed Nov 21, 2019
63c9ad0
Merge pull request #6252 from blueyed/minor-changelog
blueyed Nov 21, 2019
df0c652
Merge master into features
blueyed Nov 21, 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
8 changes: 8 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,13 @@ Here is a quick checklist that should be present in PRs.
Unless your change is trivial or a small documentation fix (e.g., a typo or reword of a small section) please:

- [ ] Create a new changelog file in the `changelog` folder, with a name like `<ISSUE NUMBER>.<TYPE>.rst`. See [changelog/README.rst](https://github.com/pytest-dev/pytest/blob/master/changelog/README.rst) for details.

Write sentences in the **past or present tense**, examples:

* *Improved verbose diff output with sequences.*
* *Terminal summary statistics now use multiple colors.*

Also make sure to end the sentence with a `.`.

- [ ] Add yourself to `AUTHORS` in alphabetical order.
-->
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ dist/
issue/
env/
.env/
.venv/
3rdparty/
.tox
.cache
Expand Down
4 changes: 0 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@ repos:
hooks:
- id: pyupgrade
args: [--py3-plus]
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.4.0
hooks:
- id: rst-backticks
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.740
hooks:
Expand Down
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ Marcelo Duarte Trevisani
Marcin Bachry
Marco Gorelli
Mark Abramowitz
Mark Dickinson
Markus Unterwaditzer
Martijn Faassen
Martin Altmayer
Expand Down
24 changes: 13 additions & 11 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ Improvements

Before:

.. code-block::
::

E AssertionError: assert ['version', '...version_info'] == ['version', '...version', ...]
E Right contains 3 more items, first extra item: ' '
Expand All @@ -129,7 +129,7 @@ Improvements

After:

.. code-block::
::

E AssertionError: assert ['version', '...version_info'] == ['version', '...version', ...]
E Right contains 3 more items, first extra item: ' '
Expand All @@ -145,6 +145,8 @@ Improvements
E ]


- `#5934 <https://github.com/pytest-dev/pytest/issues/5934>`_: ``repr`` of ``ExceptionInfo`` objects has been improved to honor the ``__repr__`` method of the underlying exception.

- `#5936 <https://github.com/pytest-dev/pytest/issues/5936>`_: Display untruncated assertion message with ``-vv``.


Expand All @@ -155,7 +157,7 @@ Improvements
immutable and avoid accidental modifications.


- `#6023 <https://github.com/pytest-dev/pytest/issues/6023>`_: ``pytest.main`` now returns a ``pytest.ExitCode`` instance now, except for when custom exit codes are used (where it returns ``int`` then still).
- `#6023 <https://github.com/pytest-dev/pytest/issues/6023>`_: ``pytest.main`` returns a ``pytest.ExitCode`` instance now, except for when custom exit codes are used (where it returns ``int`` then still).


- `#6026 <https://github.com/pytest-dev/pytest/issues/6026>`_: Align prefixes in output of pytester's ``LineMatcher``.
Expand All @@ -167,7 +169,7 @@ Improvements
- `#6069 <https://github.com/pytest-dev/pytest/issues/6069>`_: ``pytester.spawn`` does not skip/xfail tests on FreeBSD anymore unconditionally.


- `#6097 <https://github.com/pytest-dev/pytest/issues/6097>`_: The "[XXX%]" indicator in the test summary is now colored according to the final (new) multi-colored line's main color.
- `#6097 <https://github.com/pytest-dev/pytest/issues/6097>`_: The "[...%]" indicator in the test summary is now colored according to the final (new) multi-colored line's main color.


- `#6116 <https://github.com/pytest-dev/pytest/issues/6116>`_: Added ``--co`` as a synonym to ``--collect-only``.
Expand Down Expand Up @@ -3693,7 +3695,7 @@ Deprecations and Removals

- ``pytest.approx`` no longer supports ``>``, ``>=``, ``<`` and ``<=``
operators to avoid surprising/inconsistent behavior. See `the approx docs
<https://docs.pytest.org/en/latest/builtin.html#pytest.approx>`_ for more
<https://docs.pytest.org/en/latest/reference.html#pytest-approx>`_ for more
information. (`#2003 <https://github.com/pytest-dev/pytest/issues/2003>`_)

- All old-style specific behavior in current classes in the pytest's API is
Expand Down Expand Up @@ -5050,7 +5052,7 @@ time or change existing behaviors in order to make them less surprising/more use
* Fix (`#1422`_): junit record_xml_property doesn't allow multiple records
with same name.

.. _`traceback style docs`: https://pytest.org/latest/usage.html#modifying-python-traceback-printing
.. _`traceback style docs`: https://pytest.org/en/latest/usage.html#modifying-python-traceback-printing

.. _#1609: https://github.com/pytest-dev/pytest/issues/1609
.. _#1422: https://github.com/pytest-dev/pytest/issues/1422
Expand Down Expand Up @@ -5568,7 +5570,7 @@ time or change existing behaviors in order to make them less surprising/more use
- add ability to set command line options by environment variable PYTEST_ADDOPTS.

- added documentation on the new pytest-dev teams on bitbucket and
github. See https://pytest.org/latest/contributing.html .
github. See https://pytest.org/en/latest/contributing.html .
Thanks to Anatoly for pushing and initial work on this.

- fix issue650: new option ``--docttest-ignore-import-errors`` which
Expand Down Expand Up @@ -6309,7 +6311,7 @@ Bug fixes:
- yielded test functions will now have autouse-fixtures active but
cannot accept fixtures as funcargs - it's anyway recommended to
rather use the post-2.0 parametrize features instead of yield, see:
http://pytest.org/latest/example/parametrize.html
http://pytest.org/en/latest/example/parametrize.html
- fix autouse-issue where autouse-fixtures would not be discovered
if defined in an a/conftest.py file and tests in a/tests/test_some.py
- fix issue226 - LIFO ordering for fixture teardowns
Expand Down Expand Up @@ -6442,7 +6444,7 @@ Bug fixes:
- pluginmanager.register(...) now raises ValueError if the
plugin has been already registered or the name is taken

- fix issue159: improve http://pytest.org/latest/faq.html
- fix issue159: improve http://pytest.org/en/latest/faq.html
especially with respect to the "magic" history, also mention
pytest-django, trial and unittest integration.

Expand Down Expand Up @@ -6555,7 +6557,7 @@ Bug fixes:
or through plugin hooks. Also introduce a "--strict" option which
will treat unregistered markers as errors
allowing to avoid typos and maintain a well described set of markers
for your test suite. See exaples at http://pytest.org/latest/mark.html
for your test suite. See exaples at http://pytest.org/en/latest/mark.html
and its links.
- issue50: introduce "-m marker" option to select tests based on markers
(this is a stricter and more predictable version of '-k' in that "-m"
Expand Down Expand Up @@ -6738,7 +6740,7 @@ Bug fixes:
- refinements to "collecting" output on non-ttys
- refine internal plugin registration and --traceconfig output
- introduce a mechanism to prevent/unregister plugins from the
command line, see http://pytest.org/plugins.html#cmdunregister
command line, see http://pytest.org/en/latest/plugins.html#cmdunregister
- activate resultlog plugin by default
- fix regression wrt yielded tests which due to the
collection-before-running semantics were not
Expand Down
13 changes: 13 additions & 0 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,19 @@ Here is a simple overview, with pytest-specific bits:

When committing, ``pre-commit`` will re-format the files if necessary.

#. If instead of using ``tox`` you prefer to run the tests directly, then we suggest to create a virtual environment and use
an editable install with the ``testing`` extra::

$ python3 -m venv .venv
$ source .venv/bin/activate # Linux
$ .venv/Scripts/activate.bat # Windows
$ pip install -e ".[testing]"

Afterwards, you can edit the files and run pytest normally::

$ pytest testing/test_config.py


#. Commit and push once your tests pass and you are happy with your change(s)::

$ git commit -a -m "<commit message>"
Expand Down
1 change: 1 addition & 0 deletions changelog/5914.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pytester: fix ``no_fnmatch_line`` when used after positive matching.
3 changes: 3 additions & 0 deletions changelog/6255.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Clear the ``sys.last_traceback``, ``sys.last_type`` and ``sys.last_value``
attributes by deleting them instead of setting them to ``None``. This better
matches the behaviour of the Python standard library.
8 changes: 5 additions & 3 deletions changelog/README.rst
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
This directory contains "newsfragments" which are short files that contain a small **ReST**-formatted
text that will be added to the next ``CHANGELOG``.

The ``CHANGELOG`` will be read by users, so this description should be aimed to pytest users
The ``CHANGELOG`` will be read by **users**, so this description should be aimed to pytest users
instead of describing internal changes which are only relevant to the developers.

Make sure to use full sentences with correct case and punctuation, for example::
Make sure to use full sentences in the **past or present tense** and use punctuation, examples::

Fix issue with non-ascii messages from the ``warnings`` module.
Improved verbose diff output with sequences.

Terminal summary statistics now use multiple colors.

Each file should be named like ``<ISSUE>.<TYPE>.rst``, where
``<ISSUE>`` is an issue number, and ``<TYPE>`` is one of:
Expand Down
1 change: 0 additions & 1 deletion doc/5934.feature.rst

This file was deleted.

8 changes: 4 additions & 4 deletions doc/en/announce/release-2.0.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ see below for summary and detailed lists. A lot of long-deprecated code
has been removed, resulting in a much smaller and cleaner
implementation. See the new docs with examples here:

http://pytest.org/2.0.0/index.html
http://pytest.org/en/latest/index.html

A note on packaging: pytest used to part of the "py" distribution up
until version py-1.3.4 but this has changed now: pytest-2.0.0 only
Expand Down Expand Up @@ -36,12 +36,12 @@ New Features

import pytest ; pytest.main(arglist, pluginlist)

see http://pytest.org/2.0.0/usage.html for details.
see http://pytest.org/en/latest/usage.html for details.

- new and better reporting information in assert expressions
if comparing lists, sequences or strings.

see http://pytest.org/2.0.0/assert.html#newreport
see http://pytest.org/en/latest/assert.html#newreport

- new configuration through ini-files (setup.cfg or tox.ini recognized),
for example::
Expand All @@ -50,7 +50,7 @@ New Features
norecursedirs = .hg data* # don't ever recurse in such dirs
addopts = -x --pyargs # add these command line options by default

see http://pytest.org/2.0.0/customize.html
see http://pytest.org/en/latest/customize.html

- improved standard unittest support. In general py.test should now
better be able to run custom unittest.TestCases like twisted trial
Expand Down
2 changes: 1 addition & 1 deletion doc/en/announce/release-2.0.1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Changes between 2.0.0 and 2.0.1
- refinements to "collecting" output on non-ttys
- refine internal plugin registration and --traceconfig output
- introduce a mechanism to prevent/unregister plugins from the
command line, see http://pytest.org/latest/plugins.html#cmdunregister
command line, see http://pytest.org/en/latest/plugins.html#cmdunregister
- activate resultlog plugin by default
- fix regression wrt yielded tests which due to the
collection-before-running semantics were not
Expand Down
6 changes: 3 additions & 3 deletions doc/en/announce/release-2.2.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ with these improvements:

- new @pytest.mark.parametrize decorator to run tests with different arguments
- new metafunc.parametrize() API for parametrizing arguments independently
- see examples at http://pytest.org/latest/example/parametrize.html
- see examples at http://pytest.org/en/latest/example/parametrize.html
- NOTE that parametrize() related APIs are still a bit experimental
and might change in future releases.

Expand All @@ -18,7 +18,7 @@ with these improvements:
- "-m markexpr" option for selecting tests according to their mark
- a new "markers" ini-variable for registering test markers for your project
- the new "--strict" bails out with an error if using unregistered markers.
- see examples at http://pytest.org/latest/example/markers.html
- see examples at http://pytest.org/en/latest/example/markers.html

* duration profiling: new "--duration=N" option showing the N slowest test
execution or setup/teardown calls. This is most useful if you want to
Expand Down Expand Up @@ -78,7 +78,7 @@ Changes between 2.1.3 and 2.2.0
or through plugin hooks. Also introduce a "--strict" option which
will treat unregistered markers as errors
allowing to avoid typos and maintain a well described set of markers
for your test suite. See examples at http://pytest.org/latest/mark.html
for your test suite. See examples at http://pytest.org/en/latest/mark.html
and its links.
- issue50: introduce "-m marker" option to select tests based on markers
(this is a stricter and more predictable version of "-k" in that "-m"
Expand Down
10 changes: 5 additions & 5 deletions doc/en/announce/release-2.3.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ re-useable fixture design.

For detailed info and tutorial-style examples, see:

http://pytest.org/latest/fixture.html
http://pytest.org/en/latest/fixture.html

Moreover, there is now support for using pytest fixtures/funcargs with
unittest-style suites, see here for examples:

http://pytest.org/latest/unittest.html
http://pytest.org/en/latest/unittest.html

Besides, more unittest-test suites are now expected to "simply work"
with pytest.
Expand All @@ -29,11 +29,11 @@ pytest-2.2.4.

If you are interested in the precise reasoning (including examples) of the
pytest-2.3 fixture evolution, please consult
http://pytest.org/latest/funcarg_compare.html
http://pytest.org/en/latest/funcarg_compare.html

For general info on installation and getting started:

http://pytest.org/latest/getting-started.html
http://pytest.org/en/latest/getting-started.html

Docs and PDF access as usual at:

Expand Down Expand Up @@ -94,7 +94,7 @@ Changes between 2.2.4 and 2.3.0
- pluginmanager.register(...) now raises ValueError if the
plugin has been already registered or the name is taken

- fix issue159: improve http://pytest.org/latest/faq.html
- fix issue159: improve http://pytest.org/en/latest/faq.html
especially with respect to the "magic" history, also mention
pytest-django, trial and unittest integration.

Expand Down
2 changes: 1 addition & 1 deletion doc/en/announce/release-2.3.4.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ comes with the following fixes and features:
- yielded test functions will now have autouse-fixtures active but
cannot accept fixtures as funcargs - it's anyway recommended to
rather use the post-2.0 parametrize features instead of yield, see:
http://pytest.org/latest/example/parametrize.html
http://pytest.org/en/latest/example/parametrize.html
- fix autouse-issue where autouse-fixtures would not be discovered
if defined in an a/conftest.py file and tests in a/tests/test_some.py
- fix issue226 - LIFO ordering for fixture teardowns
Expand Down
2 changes: 1 addition & 1 deletion doc/en/announce/release-2.4.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ from a few supposedly very minor incompatibilities. See below for
a full list of details. A few feature highlights:

- new yield-style fixtures `pytest.yield_fixture
<http://pytest.org/latest/yieldfixture.html>`_, allowing to use
<http://pytest.org/en/latest/yieldfixture.html>`_, allowing to use
existing with-style context managers in fixture functions.

- improved pdb support: ``import pdb ; pdb.set_trace()`` now works
Expand Down
2 changes: 1 addition & 1 deletion doc/en/announce/release-2.7.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ holger krekel
- add ability to set command line options by environment variable PYTEST_ADDOPTS.

- added documentation on the new pytest-dev teams on bitbucket and
github. See https://pytest.org/latest/contributing.html .
github. See https://pytest.org/en/latest/contributing.html .
Thanks to Anatoly for pushing and initial work on this.

- fix issue650: new option ``--docttest-ignore-import-errors`` which
Expand Down
2 changes: 1 addition & 1 deletion doc/en/announce/release-2.9.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ The py.test Development Team
with same name.


.. _`traceback style docs`: https://pytest.org/latest/usage.html#modifying-python-traceback-printing
.. _`traceback style docs`: https://pytest.org/en/latest/usage.html#modifying-python-traceback-printing

.. _#1422: https://github.com/pytest-dev/pytest/issues/1422
.. _#1379: https://github.com/pytest-dev/pytest/issues/1379
Expand Down
15 changes: 14 additions & 1 deletion doc/en/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@


# The reST default role (used for this markup: `text`) to use for all documents.
# default_role = None
default_role = "literal"

# If true, '()' will be appended to :func: etc. cross-reference text.
# add_function_parentheses = True
Expand All @@ -112,6 +112,19 @@
# A list of ignored prefixes for module index sorting.
# modindex_common_prefix = []

# A list of regular expressions that match URIs that should not be checked when
# doing a linkcheck.
linkcheck_ignore = [
"https://github.com/numpy/numpy/blob/master/doc/release/1.16.0-notes.rst#new-deprecations",
"https://blogs.msdn.microsoft.com/bharry/2017/06/28/testing-in-a-cloud-delivery-cadence/",
"http://pythontesting.net/framework/pytest-introduction/",
r"https://github.com/pytest-dev/pytest/issues/\d+",
r"https://github.com/pytest-dev/pytest/pull/\d+",
]

# The number of worker threads to use when checking links (default=5).
linkcheck_workers = 5


# -- Options for HTML output ---------------------------------------------------

Expand Down
6 changes: 3 additions & 3 deletions doc/en/fixture.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ pytest fixtures: explicit, modular, scalable



.. _`xUnit`: http://en.wikipedia.org/wiki/XUnit
.. _`purpose of test fixtures`: http://en.wikipedia.org/wiki/Test_fixture#Software
.. _`Dependency injection`: http://en.wikipedia.org/wiki/Dependency_injection
.. _`xUnit`: https://en.wikipedia.org/wiki/XUnit
.. _`purpose of test fixtures`: https://en.wikipedia.org/wiki/Test_fixture#Software
.. _`Dependency injection`: https://en.wikipedia.org/wiki/Dependency_injection

The `purpose of test fixtures`_ is to provide a fixed baseline
upon which tests can reliably and repeatedly execute. pytest fixtures
Expand Down
1 change: 0 additions & 1 deletion doc/en/projects.rst
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ Some organisations using pytest

* `Square Kilometre Array, Cape Town <http://ska.ac.za/>`_
* `Some Mozilla QA people <http://www.theautomatedtester.co.uk/blog/2011/pytest_and_xdist_plugin.html>`_ use pytest to distribute their Selenium tests
* `Tandberg <http://www.tandberg.com/>`_
* `Shootq <http://web.shootq.com/>`_
* `Stups department of Heinrich Heine University Duesseldorf <http://www.stups.uni-duesseldorf.de/projects.php>`_
* cellzome
Expand Down
2 changes: 1 addition & 1 deletion doc/en/talks.rst
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Talks and blog postings
- `pytest introduction from Brian Okken (January 2013)
<http://pythontesting.net/framework/pytest-introduction/>`_

- pycon australia 2012 pytest talk from Brianna Laugher (`video <http://www.youtube.com/watch?v=DTNejE9EraI>`_, `slides <http://www.slideshare.net/pfctdayelise/funcargs-other-fun-with-pytest>`_, `code <https://gist.github.com/3386951>`_)
- pycon australia 2012 pytest talk from Brianna Laugher (`video <http://www.youtube.com/watch?v=DTNejE9EraI>`_, `slides <https://www.slideshare.net/pfctdayelise/funcargs-other-fun-with-pytest>`_, `code <https://gist.github.com/3386951>`_)
- `pycon 2012 US talk video from Holger Krekel <http://www.youtube.com/watch?v=9LVqBQcFmyw>`_

- `monkey patching done right`_ (blog post, consult `monkeypatch plugin`_ for up-to-date API)
Expand Down
Loading