Skip to content

Merge master into features #5319

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 34 commits into from
May 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
1802446
Fix invalid Python file encoding "utf8"
tambry May 12, 2019
7573747
Normalize all source encoding declarations
nicoddemus May 14, 2019
dc75b6a
Use fix-encoding-pragma pre-commit hook
asottile May 14, 2019
b81173e
Upgrade pre-commit/pre-commit-hooks
asottile May 15, 2019
93fd9de
Allow disabling of python plugin
blueyed May 16, 2019
8f04bd0
Fix misspellings
May 18, 2019
ee52a8a
Merge pull request #5287 from clickthisnick/chore-fix-misspellings
asottile May 18, 2019
b27e40c
Fix documentation of pytest.raises(match=...)
timhoffm May 19, 2019
6663cb0
Fix documentation of pytest.raises(match=...) (#5288)
nicoddemus May 19, 2019
a304dbb
Fix `disable_test_id_escaping_and_forfeit_all_rights_to_community_sup…
akiomik May 21, 2019
c5fa1d1
Update fixture.rst
May 21, 2019
d391274
Add link to tidelift to the main docs
nicoddemus May 21, 2019
65342db
Update fixture.rst (#5295)
nicoddemus May 21, 2019
45c894b
Merge pull request #5297 from nicoddemus/tidelift-contents
asottile May 21, 2019
8a49870
Add tests for #5286
akiomik May 21, 2019
de7ba59
Merge pull request #5294 from akiomik/fix-disable_test_id_escaping-op…
asottile May 21, 2019
97b85a1
changelog [ci skip]
blueyed May 23, 2019
a0ff5de
pdb: trigger pytest_enter_pdb hook with post-mortem
blueyed Mar 11, 2019
e0b584d
CaptureFixture: do not crash in _suspend when not started
blueyed May 23, 2019
6c56070
Merge pull request #5278 from blueyed/disable-python-plugin
blueyed May 23, 2019
0cacdad
Create FUNDING.yml
nicoddemus May 23, 2019
aaea4e5
Fix whitespace in FUNDING.yml
nicoddemus May 23, 2019
84c7fef
changelog: Fix typo
drothlis May 23, 2019
364ae5d
changelog: Fix typo (#5304)
nicoddemus May 23, 2019
66f20b6
Fix invalid Python file encoding "utf8" (#5252)
nicoddemus May 23, 2019
fa8a658
Merge pull request #4908 from blueyed/pdb-pm-enter-hook
blueyed May 23, 2019
31dfbb4
logging: Simple impl of multline pretty printing
twmr May 24, 2019
bed3918
Revert "logging: Simple impl of multline pretty printing"
twmr May 24, 2019
e393a73
Small change to test if pushing directly to master is disabled
nicoddemus May 24, 2019
f2ed796
pdb: import pdbcls lazily
blueyed May 24, 2019
e385610
Update docs about py27 and py34 support plans
nicoddemus May 27, 2019
bc49d6f
Update docs about py27 and py34 support plans (#5316)
nicoddemus May 27, 2019
ece774f
pdb: import pdbcls lazily (#5307)
nicoddemus May 27, 2019
e032904
Merge master into features
blueyed May 27, 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
4 changes: 4 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# info:
# * https://help.github.com/en/articles/displaying-a-sponsor-button-in-your-repository
# * https://tidelift.com/subscription/how-to-connect-tidelift-with-github
tidelift: pypi/pytest
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!--
Thanks for submitting a PR, your contribution is really appreciated!

Here's a quick checklist that should be present in PRs.
Here is a quick checklist that should be present in PRs.
(please delete this text from the final description, this is just a guideline)
-->

Expand Down
3 changes: 2 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ repos:
additional_dependencies: [black==19.3b0]
language_version: python3
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.1.0
rev: v2.2.2
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: fix-encoding-pragma
- id: check-yaml
- id: debug-statements
exclude: _pytest/debugging.py
Expand Down
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Abhijeet Kasurde
Adam Johnson
Adam Uhlir
Ahn Ki-Wook
Akiomi Kamakura
Alan Velasco
Alexander Johnson
Alexei Kozlenok
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1630,7 +1630,7 @@ Bug Fixes
- `#2220 <https://github.com/pytest-dev/pytest/issues/2220>`_: Fix a bug where fixtures overridden by direct parameters (for example parametrization) were being instantiated even if they were not being used by a test.


- `#3695 <https://github.com/pytest-dev/pytest/issues/3695>`_: Fix ``ApproxNumpy`` initialisation argument mixup, ``abs`` and ``rel`` tolerances were flipped causing strange comparsion results.
- `#3695 <https://github.com/pytest-dev/pytest/issues/3695>`_: Fix ``ApproxNumpy`` initialisation argument mixup, ``abs`` and ``rel`` tolerances were flipped causing strange comparison results.
Add tests to check ``abs`` and ``rel`` tolerances for ``np.array`` and test for expecting ``nan`` with ``np.array()``


Expand Down
1 change: 1 addition & 0 deletions bench/bench.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
import sys

if __name__ == "__main__":
Expand Down
1 change: 1 addition & 0 deletions bench/bench_argcomplete.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
# 10000 iterations, just for relative comparison
# 2.7.5 3.3.2
# FilesCompleter 75.1109 69.2116
Expand Down
1 change: 1 addition & 0 deletions bench/empty.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# -*- coding: utf-8 -*-
for i in range(1000):
exec("def test_func_%d(): pass" % i)
1 change: 1 addition & 0 deletions bench/manyparam.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
import pytest


Expand Down
1 change: 1 addition & 0 deletions bench/skip.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
from six.moves import range

import pytest
Expand Down
1 change: 1 addition & 0 deletions changelog/2064.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The debugging plugin imports the wrapped ``Pdb`` class (``--pdbcls``) on-demand now.
1 change: 1 addition & 0 deletions changelog/4908.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The ``pytest_enter_pdb`` hook gets called with post-mortem (``--pdb``).
1 change: 1 addition & 0 deletions changelog/5278.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Pytest's internal python plugin can be disabled using ``-p no:python`` again.
1 change: 1 addition & 0 deletions changelog/5286.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix issue with ``disable_test_id_escaping_and_forfeit_all_rights_to_community_support`` option doesn't work when using a list of test IDs in parametrized tests.
1 change: 1 addition & 0 deletions doc/en/_themes/flask_theme_support.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
# flasky extensions. flasky pygments style based on tango style
from pygments.style import Style
from pygments.token import Comment
Expand Down
1 change: 1 addition & 0 deletions doc/en/conftest.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
# -*- coding: utf-8 -*-
collect_ignore = ["conf.py"]
1 change: 1 addition & 0 deletions doc/en/contents.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ Full pytest documentation
projects
faq
contact
tidelift

.. only:: html

Expand Down
1 change: 1 addition & 0 deletions doc/en/example/assertion/failure_demo.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
import _pytest._code
import pytest
from pytest import raises
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
import py

import pytest
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
hello = "world"


Expand Down
1 change: 1 addition & 0 deletions doc/en/example/assertion/test_failures.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
import py

failure_demo = py.path.local(__file__).dirpath("failure_demo.py")
Expand Down
1 change: 1 addition & 0 deletions doc/en/example/assertion/test_setup_flow_example.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
def setup_module(module):
module.TestStateFullThing.classcount = 0

Expand Down
1 change: 1 addition & 0 deletions doc/en/example/conftest.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
# -*- coding: utf-8 -*-
collect_ignore = ["nonpython"]
1 change: 1 addition & 0 deletions doc/en/example/costlysetup/conftest.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
import pytest


Expand Down
1 change: 1 addition & 0 deletions doc/en/example/costlysetup/sub_a/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
# -*- coding: utf-8 -*-
#
1 change: 1 addition & 0 deletions doc/en/example/costlysetup/sub_a/test_quick.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# -*- coding: utf-8 -*-
def test_quick(setup):
pass
1 change: 1 addition & 0 deletions doc/en/example/costlysetup/sub_b/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
# -*- coding: utf-8 -*-
#
1 change: 1 addition & 0 deletions doc/en/example/costlysetup/sub_b/test_two.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
def test_something(setup):
assert setup.timecostly == 1

Expand Down
1 change: 1 addition & 0 deletions doc/en/example/multipython.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
"""
module containing a parametrized tests testing cross-python
serialization via the pickle module.
Expand Down
1 change: 1 addition & 0 deletions doc/en/example/nonpython/conftest.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
# content of conftest.py
import pytest

Expand Down
1 change: 1 addition & 0 deletions doc/en/example/py2py3/conftest.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
import sys

import pytest
Expand Down
1 change: 1 addition & 0 deletions doc/en/example/py2py3/test_py3.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
def test_exception_syntax():
try:
0 / 0
Expand Down
1 change: 1 addition & 0 deletions doc/en/example/pythoncollection.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
# run this with $ pytest --collect-only test_collectonly.py
#

Expand Down
1 change: 1 addition & 0 deletions doc/en/example/xfail_demo.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
import pytest

xfail = pytest.mark.xfail
Expand Down
2 changes: 2 additions & 0 deletions doc/en/fixture.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1179,6 +1179,8 @@ Given the tests file structure is:

conftest.py
# content of tests/conftest.py
import pytest

@pytest.fixture
def username():
return 'username'
Expand Down
22 changes: 13 additions & 9 deletions doc/en/py27-py34-deprecation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,20 @@ Python 3.4's last release is scheduled for
`March 2019 <https://www.python.org/dev/peps/pep-0429/#release-schedule>`__. pytest is one of
the participating projects of the https://python3statement.org.

We plan to drop support for Python 2.7 and 3.4 at the same time with the release of **pytest 5.0**,
scheduled to be released by **mid-2019**. Thanks to the `python_requires <https://packaging.python.org/guides/distributing-packages-using-setuptools/#python-requires>`__ ``setuptools`` option,
The **pytest 4.6** series will be the last to support Python 2.7 and 3.4, and is scheduled
to be released by **mid-2019**. **pytest 5.0** and onwards will support only Python 3.5+.

Thanks to the `python_requires`_ ``setuptools`` option,
Python 2.7 and Python 3.4 users using a modern ``pip`` version
will install the last compatible pytest ``4.X`` version automatically even if ``5.0`` or later
will install the last pytest ``4.6`` version automatically even if ``5.0`` or later
are available on PyPI.

During the period **from mid-2019 and 2020**, the pytest core team plans to make
bug-fix releases of the pytest ``4.X`` series by back-porting patches to the ``4.x-maintenance``
branch.
While pytest ``5.0`` will be the new mainstream and development version, until **January 2020**
the pytest core team plans to make bug-fix releases of the pytest ``4.6`` series by
back-porting patches to the ``4.6-maintenance`` branch that affect Python 2 users.

**After 2020**, the core team will no longer actively backport patches, but the ``4.6-maintenance``
branch will continue to exist so the community itself can contribute patches. The core team will
be happy to accept those patches and make new ``4.6`` releases **until mid-2020**.

**After 2020**, the core team will no longer actively back port-patches, but the ``4.x-maintenance``
branch will continue to exist so the community itself can contribute patches. The
core team will be happy to accept those patches and make new ``4.X`` releases **until mid-2020**.
.. _`python_requires`: https://packaging.python.org/guides/distributing-packages-using-setuptools/#python-requires>
4 changes: 4 additions & 0 deletions doc/en/tidelift.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@



.. include:: ../../TIDELIFT.rst
1 change: 1 addition & 0 deletions extra/get_issues.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
import json

import py
Expand Down
1 change: 1 addition & 0 deletions extra/setup-py.test/setup.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
import sys
from distutils.core import setup

Expand Down
1 change: 1 addition & 0 deletions scripts/release.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
"""
Invoke development tasks.
"""
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
from setuptools import setup

# TODO: if py gets upgrade to >=1.6,
Expand Down
1 change: 1 addition & 0 deletions src/_pytest/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
__all__ = ["__version__"]

try:
Expand Down
1 change: 1 addition & 0 deletions src/_pytest/_argcomplete.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
"""allow bash-completion for argparse with argcomplete if installed
needs argcomplete>=0.5.6 for python 3.2/3.3 (older versions fail
to find the magic string, so _ARGCOMPLETE env. var is never set, and
Expand Down
1 change: 1 addition & 0 deletions src/_pytest/_code/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
""" python inspection/code generation API """
from __future__ import absolute_import
from __future__ import division
Expand Down
1 change: 1 addition & 0 deletions src/_pytest/_code/_py2traceback.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
# copied from python-2.7.3's traceback.py
# CHANGES:
# - some_str is replaced, trying to create unicode strings
Expand Down
10 changes: 6 additions & 4 deletions src/_pytest/_code/code.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
Expand Down Expand Up @@ -564,10 +565,11 @@ def __unicode__(self):

def match(self, regexp):
"""
Match the regular expression 'regexp' on the string representation of
the exception. If it matches then True is returned (so that it is
possible to write 'assert excinfo.match()'). If it doesn't match an
AssertionError is raised.
Check whether the regular expression 'regexp' is found in the string
representation of the exception using ``re.search``. If it matches
then True is returned (so that it is possible to write
``assert excinfo.match()``). If it doesn't match an AssertionError is
raised.
"""
__tracebackhide__ = True
if not re.search(regexp, str(self.value)):
Expand Down
1 change: 1 addition & 0 deletions src/_pytest/_code/source.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
Expand Down
1 change: 1 addition & 0 deletions src/_pytest/_io/saferepr.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
import pprint

from six.moves import reprlib
Expand Down
1 change: 1 addition & 0 deletions src/_pytest/assertion/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
"""
support for presenting detailed information in failing assertions.
"""
Expand Down
6 changes: 5 additions & 1 deletion src/_pytest/assertion/rewrite.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
"""Rewrite assertion AST to produce nice error messages"""
from __future__ import absolute_import
from __future__ import division
Expand Down Expand Up @@ -60,7 +61,10 @@ class AssertionRewritingHook(object):

def __init__(self, config):
self.config = config
self.fnpats = config.getini("python_files")
try:
self.fnpats = config.getini("python_files")
except ValueError:
self.fnpats = ["test_*.py", "*_test.py"]
self.session = None
self.modules = {}
self._rewritten_names = set()
Expand Down
1 change: 1 addition & 0 deletions src/_pytest/assertion/truncate.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
"""
Utilities for truncating assertion output.

Expand Down
1 change: 1 addition & 0 deletions src/_pytest/assertion/util.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
"""Utilities for assertion debugging"""
from __future__ import absolute_import
from __future__ import division
Expand Down
1 change: 1 addition & 0 deletions src/_pytest/cacheprovider.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
"""
merged implementation of the cache provider

Expand Down
10 changes: 6 additions & 4 deletions src/_pytest/capture.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
"""
per-test stdout/stderr capturing mechanism.

Expand Down Expand Up @@ -358,8 +359,7 @@ def __init__(self, captureclass, request):
self._captured_err = self.captureclass.EMPTY_BUFFER

def _start(self):
# Start if not started yet
if getattr(self, "_capture", None) is None:
if self._capture is None:
self._capture = MultiCapture(
out=True, err=True, in_=False, Capture=self.captureclass
)
Expand Down Expand Up @@ -389,11 +389,13 @@ def readouterr(self):

def _suspend(self):
"""Suspends this fixture's own capturing temporarily."""
self._capture.suspend_capturing()
if self._capture is not None:
self._capture.suspend_capturing()

def _resume(self):
"""Resumes this fixture's own capturing temporarily."""
self._capture.resume_capturing()
if self._capture is not None:
self._capture.resume_capturing()

@contextlib.contextmanager
def disabled(self):
Expand Down
1 change: 1 addition & 0 deletions src/_pytest/compat.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
"""
python version compatibility code
"""
Expand Down
7 changes: 4 additions & 3 deletions src/_pytest/config/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
""" command line options, ini-file and conftest.py processing. """
from __future__ import absolute_import
from __future__ import division
Expand Down Expand Up @@ -115,16 +116,16 @@ def directory_arg(path, optname):


# Plugins that cannot be disabled via "-p no:X" currently.
essential_plugins = (
essential_plugins = ( # fmt: off
"mark",
"main",
"runner",
"python",
"fixtures",
"helpconfig", # Provides -p.
)
) # fmt: on

default_plugins = essential_plugins + (
"python",
"terminal",
"debugging",
"unittest",
Expand Down
1 change: 1 addition & 0 deletions src/_pytest/config/argparsing.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
import argparse
import warnings

Expand Down
1 change: 1 addition & 0 deletions src/_pytest/config/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
class UsageError(Exception):
""" error in pytest usage or invocation"""

Expand Down
1 change: 1 addition & 0 deletions src/_pytest/config/findpaths.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
import os

import py
Expand Down
Loading