Merge master into features

This commit is contained in:
Daniel Hahler 2019-05-28 01:46:16 +02:00
commit e032904413
188 changed files with 415 additions and 106 deletions

4
.github/FUNDING.yml vendored Normal file
View File

@ -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

View File

@ -1,7 +1,7 @@
<!-- <!--
Thanks for submitting a PR, your contribution is really appreciated! 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) (please delete this text from the final description, this is just a guideline)
--> -->

View File

@ -13,10 +13,11 @@ repos:
additional_dependencies: [black==19.3b0] additional_dependencies: [black==19.3b0]
language_version: python3 language_version: python3
- repo: https://github.com/pre-commit/pre-commit-hooks - repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.1.0 rev: v2.2.2
hooks: hooks:
- id: trailing-whitespace - id: trailing-whitespace
- id: end-of-file-fixer - id: end-of-file-fixer
- id: fix-encoding-pragma
- id: check-yaml - id: check-yaml
- id: debug-statements - id: debug-statements
exclude: _pytest/debugging.py exclude: _pytest/debugging.py

View File

@ -9,6 +9,7 @@ Abhijeet Kasurde
Adam Johnson Adam Johnson
Adam Uhlir Adam Uhlir
Ahn Ki-Wook Ahn Ki-Wook
Akiomi Kamakura
Alan Velasco Alan Velasco
Alexander Johnson Alexander Johnson
Alexei Kozlenok Alexei Kozlenok

View File

@ -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. - `#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()`` Add tests to check ``abs`` and ``rel`` tolerances for ``np.array`` and test for expecting ``nan`` with ``np.array()``

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
import sys import sys
if __name__ == "__main__": if __name__ == "__main__":

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
# 10000 iterations, just for relative comparison # 10000 iterations, just for relative comparison
# 2.7.5 3.3.2 # 2.7.5 3.3.2
# FilesCompleter 75.1109 69.2116 # FilesCompleter 75.1109 69.2116

View File

@ -1,2 +1,3 @@
# -*- coding: utf-8 -*-
for i in range(1000): for i in range(1000):
exec("def test_func_%d(): pass" % i) exec("def test_func_%d(): pass" % i)

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
import pytest import pytest

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
from six.moves import range from six.moves import range
import pytest import pytest

View File

@ -0,0 +1 @@
The debugging plugin imports the wrapped ``Pdb`` class (``--pdbcls``) on-demand now.

View File

@ -0,0 +1 @@
The ``pytest_enter_pdb`` hook gets called with post-mortem (``--pdb``).

View File

@ -0,0 +1 @@
Pytest's internal python plugin can be disabled using ``-p no:python`` again.

View File

@ -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.

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
# flasky extensions. flasky pygments style based on tango style # flasky extensions. flasky pygments style based on tango style
from pygments.style import Style from pygments.style import Style
from pygments.token import Comment from pygments.token import Comment

View File

@ -1 +1,2 @@
# -*- coding: utf-8 -*-
collect_ignore = ["conf.py"] collect_ignore = ["conf.py"]

View File

@ -50,6 +50,7 @@ Full pytest documentation
projects projects
faq faq
contact contact
tidelift
.. only:: html .. only:: html

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
import _pytest._code import _pytest._code
import pytest import pytest
from pytest import raises from pytest import raises

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
import py import py
import pytest import pytest

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
hello = "world" hello = "world"

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
import py import py
failure_demo = py.path.local(__file__).dirpath("failure_demo.py") failure_demo = py.path.local(__file__).dirpath("failure_demo.py")

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
def setup_module(module): def setup_module(module):
module.TestStateFullThing.classcount = 0 module.TestStateFullThing.classcount = 0

View File

@ -1 +1,2 @@
# -*- coding: utf-8 -*-
collect_ignore = ["nonpython"] collect_ignore = ["nonpython"]

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
import pytest import pytest

View File

@ -1 +1,2 @@
# -*- coding: utf-8 -*-
# #

View File

@ -1,2 +1,3 @@
# -*- coding: utf-8 -*-
def test_quick(setup): def test_quick(setup):
pass pass

View File

@ -1 +1,2 @@
# -*- coding: utf-8 -*-
# #

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
def test_something(setup): def test_something(setup):
assert setup.timecostly == 1 assert setup.timecostly == 1

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
""" """
module containing a parametrized tests testing cross-python module containing a parametrized tests testing cross-python
serialization via the pickle module. serialization via the pickle module.

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
# content of conftest.py # content of conftest.py
import pytest import pytest

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
import sys import sys
import pytest import pytest

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
def test_exception_syntax(): def test_exception_syntax():
try: try:
0 / 0 0 / 0

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
# run this with $ pytest --collect-only test_collectonly.py # run this with $ pytest --collect-only test_collectonly.py
# #

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
import pytest import pytest
xfail = pytest.mark.xfail xfail = pytest.mark.xfail

View File

@ -1179,6 +1179,8 @@ Given the tests file structure is:
conftest.py conftest.py
# content of tests/conftest.py # content of tests/conftest.py
import pytest
@pytest.fixture @pytest.fixture
def username(): def username():
return 'username' return 'username'

View File

@ -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 `March 2019 <https://www.python.org/dev/peps/pep-0429/#release-schedule>`__. pytest is one of
the participating projects of the https://python3statement.org. 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**, The **pytest 4.6** series will be the last to support Python 2.7 and 3.4, and is scheduled
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, 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 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. are available on PyPI.
During the period **from mid-2019 and 2020**, the pytest core team plans to make While pytest ``5.0`` will be the new mainstream and development version, until **January 2020**
bug-fix releases of the pytest ``4.X`` series by back-porting patches to the ``4.x-maintenance`` the pytest core team plans to make bug-fix releases of the pytest ``4.6`` series by
branch. back-porting patches to the ``4.6-maintenance`` branch that affect Python 2 users.
**After 2020**, the core team will no longer actively back port-patches, but the ``4.x-maintenance`` **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 branch will continue to exist so the community itself can contribute patches. The core team will
core team will be happy to accept those patches and make new ``4.X`` releases **until mid-2020**. 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>

4
doc/en/tidelift.rst Normal file
View File

@ -0,0 +1,4 @@
.. include:: ../../TIDELIFT.rst

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
import json import json
import py import py

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
import sys import sys
from distutils.core import setup from distutils.core import setup

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
""" """
Invoke development tasks. Invoke development tasks.
""" """

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
from setuptools import setup from setuptools import setup
# TODO: if py gets upgrade to >=1.6, # TODO: if py gets upgrade to >=1.6,

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
__all__ = ["__version__"] __all__ = ["__version__"]
try: try:

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
"""allow bash-completion for argparse with argcomplete if installed """allow bash-completion for argparse with argcomplete if installed
needs argcomplete>=0.5.6 for python 3.2/3.3 (older versions fail 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 to find the magic string, so _ARGCOMPLETE env. var is never set, and

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
""" python inspection/code generation API """ """ python inspection/code generation API """
from __future__ import absolute_import from __future__ import absolute_import
from __future__ import division from __future__ import division

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
# copied from python-2.7.3's traceback.py # copied from python-2.7.3's traceback.py
# CHANGES: # CHANGES:
# - some_str is replaced, trying to create unicode strings # - some_str is replaced, trying to create unicode strings

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import from __future__ import absolute_import
from __future__ import division from __future__ import division
from __future__ import print_function from __future__ import print_function
@ -564,10 +565,11 @@ class ExceptionInfo(object):
def match(self, regexp): def match(self, regexp):
""" """
Match the regular expression 'regexp' on the string representation of Check whether the regular expression 'regexp' is found in the string
the exception. If it matches then True is returned (so that it is representation of the exception using ``re.search``. If it matches
possible to write 'assert excinfo.match()'). If it doesn't match an then True is returned (so that it is possible to write
AssertionError is raised. ``assert excinfo.match()``). If it doesn't match an AssertionError is
raised.
""" """
__tracebackhide__ = True __tracebackhide__ = True
if not re.search(regexp, str(self.value)): if not re.search(regexp, str(self.value)):

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import from __future__ import absolute_import
from __future__ import division from __future__ import division
from __future__ import print_function from __future__ import print_function

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
import pprint import pprint
from six.moves import reprlib from six.moves import reprlib

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
""" """
support for presenting detailed information in failing assertions. support for presenting detailed information in failing assertions.
""" """

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
"""Rewrite assertion AST to produce nice error messages""" """Rewrite assertion AST to produce nice error messages"""
from __future__ import absolute_import from __future__ import absolute_import
from __future__ import division from __future__ import division
@ -60,7 +61,10 @@ class AssertionRewritingHook(object):
def __init__(self, config): def __init__(self, config):
self.config = 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.session = None
self.modules = {} self.modules = {}
self._rewritten_names = set() self._rewritten_names = set()

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
""" """
Utilities for truncating assertion output. Utilities for truncating assertion output.

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
"""Utilities for assertion debugging""" """Utilities for assertion debugging"""
from __future__ import absolute_import from __future__ import absolute_import
from __future__ import division from __future__ import division

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
""" """
merged implementation of the cache provider merged implementation of the cache provider

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
""" """
per-test stdout/stderr capturing mechanism. per-test stdout/stderr capturing mechanism.
@ -358,8 +359,7 @@ class CaptureFixture(object):
self._captured_err = self.captureclass.EMPTY_BUFFER self._captured_err = self.captureclass.EMPTY_BUFFER
def _start(self): def _start(self):
# Start if not started yet if self._capture is None:
if getattr(self, "_capture", None) is None:
self._capture = MultiCapture( self._capture = MultiCapture(
out=True, err=True, in_=False, Capture=self.captureclass out=True, err=True, in_=False, Capture=self.captureclass
) )
@ -389,11 +389,13 @@ class CaptureFixture(object):
def _suspend(self): def _suspend(self):
"""Suspends this fixture's own capturing temporarily.""" """Suspends this fixture's own capturing temporarily."""
self._capture.suspend_capturing() if self._capture is not None:
self._capture.suspend_capturing()
def _resume(self): def _resume(self):
"""Resumes this fixture's own capturing temporarily.""" """Resumes this fixture's own capturing temporarily."""
self._capture.resume_capturing() if self._capture is not None:
self._capture.resume_capturing()
@contextlib.contextmanager @contextlib.contextmanager
def disabled(self): def disabled(self):

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
""" """
python version compatibility code python version compatibility code
""" """

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
""" command line options, ini-file and conftest.py processing. """ """ command line options, ini-file and conftest.py processing. """
from __future__ import absolute_import from __future__ import absolute_import
from __future__ import division from __future__ import division
@ -115,16 +116,16 @@ def directory_arg(path, optname):
# Plugins that cannot be disabled via "-p no:X" currently. # Plugins that cannot be disabled via "-p no:X" currently.
essential_plugins = ( essential_plugins = ( # fmt: off
"mark", "mark",
"main", "main",
"runner", "runner",
"python",
"fixtures", "fixtures",
"helpconfig", # Provides -p. "helpconfig", # Provides -p.
) ) # fmt: on
default_plugins = essential_plugins + ( default_plugins = essential_plugins + (
"python",
"terminal", "terminal",
"debugging", "debugging",
"unittest", "unittest",

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
import argparse import argparse
import warnings import warnings

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
class UsageError(Exception): class UsageError(Exception):
""" error in pytest usage or invocation""" """ error in pytest usage or invocation"""

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
import os import os
import py import py

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
""" interactive debugging with PDB, the Python Debugger. """ """ interactive debugging with PDB, the Python Debugger. """
from __future__ import absolute_import from __future__ import absolute_import
from __future__ import division from __future__ import division
@ -48,42 +49,18 @@ def pytest_addoption(parser):
) )
def _import_pdbcls(modname, classname):
try:
__import__(modname)
mod = sys.modules[modname]
# Handle --pdbcls=pdb:pdb.Pdb (useful e.g. with pdbpp).
parts = classname.split(".")
pdb_cls = getattr(mod, parts[0])
for part in parts[1:]:
pdb_cls = getattr(pdb_cls, part)
return pdb_cls
except Exception as exc:
value = ":".join((modname, classname))
raise UsageError("--pdbcls: could not import {!r}: {}".format(value, exc))
def pytest_configure(config): def pytest_configure(config):
pdb_cls = config.getvalue("usepdb_cls")
if pdb_cls:
pdb_cls = _import_pdbcls(*pdb_cls)
else:
pdb_cls = pdb.Pdb
if config.getvalue("trace"): if config.getvalue("trace"):
config.pluginmanager.register(PdbTrace(), "pdbtrace") config.pluginmanager.register(PdbTrace(), "pdbtrace")
if config.getvalue("usepdb"): if config.getvalue("usepdb"):
config.pluginmanager.register(PdbInvoke(), "pdbinvoke") config.pluginmanager.register(PdbInvoke(), "pdbinvoke")
pytestPDB._saved.append( pytestPDB._saved.append(
(pdb.set_trace, pytestPDB._pluginmanager, pytestPDB._config, pytestPDB._pdb_cls) (pdb.set_trace, pytestPDB._pluginmanager, pytestPDB._config)
) )
pdb.set_trace = pytestPDB.set_trace pdb.set_trace = pytestPDB.set_trace
pytestPDB._pluginmanager = config.pluginmanager pytestPDB._pluginmanager = config.pluginmanager
pytestPDB._config = config pytestPDB._config = config
pytestPDB._pdb_cls = pdb_cls
# NOTE: not using pytest_unconfigure, since it might get called although # NOTE: not using pytest_unconfigure, since it might get called although
# pytest_configure was not (if another plugin raises UsageError). # pytest_configure was not (if another plugin raises UsageError).
@ -92,7 +69,6 @@ def pytest_configure(config):
pdb.set_trace, pdb.set_trace,
pytestPDB._pluginmanager, pytestPDB._pluginmanager,
pytestPDB._config, pytestPDB._config,
pytestPDB._pdb_cls,
) = pytestPDB._saved.pop() ) = pytestPDB._saved.pop()
config._cleanup.append(fin) config._cleanup.append(fin)
@ -103,7 +79,6 @@ class pytestPDB(object):
_pluginmanager = None _pluginmanager = None
_config = None _config = None
_pdb_cls = pdb.Pdb
_saved = [] _saved = []
_recursive_debug = 0 _recursive_debug = 0
@ -113,6 +88,33 @@ class pytestPDB(object):
return capman.is_capturing() return capman.is_capturing()
return False return False
@classmethod
def _import_pdb_cls(cls):
if not cls._config:
# Happens when using pytest.set_trace outside of a test.
return pdb.Pdb
pdb_cls = cls._config.getvalue("usepdb_cls")
if not pdb_cls:
return pdb.Pdb
modname, classname = pdb_cls
try:
__import__(modname)
mod = sys.modules[modname]
# Handle --pdbcls=pdb:pdb.Pdb (useful e.g. with pdbpp).
parts = classname.split(".")
pdb_cls = getattr(mod, parts[0])
for part in parts[1:]:
pdb_cls = getattr(pdb_cls, part)
return pdb_cls
except Exception as exc:
value = ":".join((modname, classname))
raise UsageError("--pdbcls: could not import {!r}: {}".format(value, exc))
@classmethod @classmethod
def _init_pdb(cls, *args, **kwargs): def _init_pdb(cls, *args, **kwargs):
""" Initialize PDB debugging, dropping any IO capturing. """ """ Initialize PDB debugging, dropping any IO capturing. """
@ -143,7 +145,9 @@ class pytestPDB(object):
else: else:
tw.sep(">", "PDB set_trace") tw.sep(">", "PDB set_trace")
class PytestPdbWrapper(cls._pdb_cls, object): pdb_cls = cls._import_pdb_cls()
class PytestPdbWrapper(pdb_cls, object):
_pytest_capman = capman _pytest_capman = capman
_continued = False _continued = False
@ -212,10 +216,22 @@ class pytestPDB(object):
self._pytest_capman.suspend_global_capture(in_=True) self._pytest_capman.suspend_global_capture(in_=True)
return ret return ret
def get_stack(self, f, t):
stack, i = super(PytestPdbWrapper, self).get_stack(f, t)
if f is None:
# Find last non-hidden frame.
i = max(0, len(stack) - 1)
while i and stack[i][0].f_locals.get(
"__tracebackhide__", False
):
i -= 1
return stack, i
_pdb = PytestPdbWrapper(**kwargs) _pdb = PytestPdbWrapper(**kwargs)
cls._pluginmanager.hook.pytest_enter_pdb(config=cls._config, pdb=_pdb) cls._pluginmanager.hook.pytest_enter_pdb(config=cls._config, pdb=_pdb)
else: else:
_pdb = cls._pdb_cls(**kwargs) pdb_cls = cls._import_pdb_cls()
_pdb = pdb_cls(**kwargs)
return _pdb return _pdb
@classmethod @classmethod
@ -298,22 +314,8 @@ def _postmortem_traceback(excinfo):
return excinfo._excinfo[2] return excinfo._excinfo[2]
def _find_last_non_hidden_frame(stack):
i = max(0, len(stack) - 1)
while i and stack[i][0].f_locals.get("__tracebackhide__", False):
i -= 1
return i
def post_mortem(t): def post_mortem(t):
class Pdb(pytestPDB._pdb_cls, object): p = pytestPDB._init_pdb()
def get_stack(self, f, t):
stack, i = super(Pdb, self).get_stack(f, t)
if f is None:
i = _find_last_non_hidden_frame(stack)
return stack, i
p = Pdb()
p.reset() p.reset()
p.interaction(None, t) p.interaction(None, t)
if p.quitting: if p.quitting:

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
""" """
This module contains deprecation messages and bits of code used elsewhere in the codebase This module contains deprecation messages and bits of code used elsewhere in the codebase
that is planned to be removed in the next pytest release. that is planned to be removed in the next pytest release.

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
""" discover and run doctests in modules and test files.""" """ discover and run doctests in modules and test files."""
from __future__ import absolute_import from __future__ import absolute_import
from __future__ import division from __future__ import division

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import from __future__ import absolute_import
from __future__ import division from __future__ import division
from __future__ import print_function from __future__ import print_function
@ -1073,6 +1074,15 @@ def pytestconfig(request):
return request.config return request.config
def pytest_addoption(parser):
parser.addini(
"usefixtures",
type="args",
default=[],
help="list of default fixtures to be used with this project",
)
class FixtureManager(object): class FixtureManager(object):
""" """
pytest fixtures definitions and information is stored and managed pytest fixtures definitions and information is stored and managed

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
""" """
Provides a function to report all internal modules for using freezing tools Provides a function to report all internal modules for using freezing tools
pytest pytest

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
""" version info, help messages, tracing configuration. """ """ version info, help messages, tracing configuration. """
from __future__ import absolute_import from __future__ import absolute_import
from __future__ import division from __future__ import division

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
""" hook specifications for pytest plugins, invoked from main.py and builtin plugins. """ """ hook specifications for pytest plugins, invoked from main.py and builtin plugins. """
from pluggy import HookspecMarker from pluggy import HookspecMarker

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
""" """
report test results in JUnit-XML format, report test results in JUnit-XML format,
for use with Jenkins and build integration servers. for use with Jenkins and build integration servers.

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
""" Access and control log capturing. """ """ Access and control log capturing. """
from __future__ import absolute_import from __future__ import absolute_import
from __future__ import division from __future__ import division

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
""" core implementation of testing process: init, session, runtest loop. """ """ core implementation of testing process: init, session, runtest loop. """
from __future__ import absolute_import from __future__ import absolute_import
from __future__ import division from __future__ import division

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
""" generic mechanism for marking and selecting python functions. """ """ generic mechanism for marking and selecting python functions. """
from __future__ import absolute_import from __future__ import absolute_import
from __future__ import division from __future__ import division

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
import os import os
import platform import platform
import sys import sys

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
""" """
this is a place where we put datastructures used by legacy apis this is a place where we put datastructures used by legacy apis
we hope ot remove we hope ot remove

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
import inspect import inspect
import warnings import warnings
from collections import namedtuple from collections import namedtuple

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
""" monkeypatching and mocking functionality. """ """ monkeypatching and mocking functionality. """
from __future__ import absolute_import from __future__ import absolute_import
from __future__ import division from __future__ import division

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import from __future__ import absolute_import
from __future__ import division from __future__ import division
from __future__ import print_function from __future__ import print_function

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
""" run test suites written for nose. """ """ run test suites written for nose. """
from __future__ import absolute_import from __future__ import absolute_import
from __future__ import division from __future__ import division

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
""" """
exception classes and constants handling test outcomes exception classes and constants handling test outcomes
as well as functions creating them as well as functions creating them

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
""" submit failure or test session information to a pastebin service. """ """ submit failure or test session information to a pastebin service. """
from __future__ import absolute_import from __future__ import absolute_import
from __future__ import division from __future__ import division

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
import atexit import atexit
import errno import errno
import fnmatch import fnmatch

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
"""(disabled by default) support for testing pytest and pytest plugins.""" """(disabled by default) support for testing pytest and pytest plugins."""
from __future__ import absolute_import from __future__ import absolute_import
from __future__ import division from __future__ import division

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
""" Python test discovery, setup and run of test functions. """ """ Python test discovery, setup and run of test functions. """
from __future__ import absolute_import from __future__ import absolute_import
from __future__ import division from __future__ import division
@ -79,15 +80,10 @@ def pytest_addoption(parser):
default=False, default=False,
help="show fixtures per test", help="show fixtures per test",
) )
parser.addini(
"usefixtures",
type="args",
default=[],
help="list of default fixtures to be used with this project",
)
parser.addini( parser.addini(
"python_files", "python_files",
type="args", type="args",
# NOTE: default is also used in AssertionRewritingHook.
default=["test_*.py", "*_test.py"], default=["test_*.py", "*_test.py"],
help="glob-style file patterns for Python test module discovery", help="glob-style file patterns for Python test module discovery",
) )
@ -1217,7 +1213,7 @@ def _idvalset(idx, parameterset, argnames, idfn, ids, item, config):
] ]
return "-".join(this_id) return "-".join(this_id)
else: else:
return ascii_escaped(ids[idx]) return _ascii_escaped_by_config(ids[idx], config)
def idmaker(argnames, parametersets, idfn=None, ids=None, config=None, item=None): def idmaker(argnames, parametersets, idfn=None, ids=None, config=None, item=None):

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import from __future__ import absolute_import
import math import math
@ -559,7 +560,7 @@ def raises(expected_exception, *args, **kwargs):
:kwparam match: if specified, a string containing a regular expression, :kwparam match: if specified, a string containing a regular expression,
or a regular expression object, that is tested against the string or a regular expression object, that is tested against the string
representation of the exception using ``re.match``. To match a literal representation of the exception using ``re.search``. To match a literal
string that may contain `special characters`__, the pattern can string that may contain `special characters`__, the pattern can
first be escaped with ``re.escape``. first be escaped with ``re.escape``.

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
""" recording warnings during test function execution. """ """ recording warnings during test function execution. """
from __future__ import absolute_import from __future__ import absolute_import
from __future__ import division from __future__ import division

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
from pprint import pprint from pprint import pprint
import py import py

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
""" log machine-parseable test session result information in a plain """ log machine-parseable test session result information in a plain
text file. text file.
""" """

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
""" basic collect and runtest protocol implementations """ """ basic collect and runtest protocol implementations """
from __future__ import absolute_import from __future__ import absolute_import
from __future__ import division from __future__ import division

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import from __future__ import absolute_import
from __future__ import division from __future__ import division
from __future__ import print_function from __future__ import print_function

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import from __future__ import absolute_import
from __future__ import division from __future__ import division
from __future__ import print_function from __future__ import print_function

View File

@ -1,4 +1,4 @@
# coding=utf8 # -*- coding: utf-8 -*-
""" support for skip/xfail functions and markers. """ """ support for skip/xfail functions and markers. """
from __future__ import absolute_import from __future__ import absolute_import
from __future__ import division from __future__ import division

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
import pytest import pytest

View File

@ -1,4 +1,4 @@
# encoding: utf-8 # -*- coding: utf-8 -*-
""" terminal reporting of the full testing process. """ terminal reporting of the full testing process.
This is a good source for looking at the various reporting hooks. This is a good source for looking at the various reporting hooks.

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
""" support for providing temporary directories to test functions. """ """ support for providing temporary directories to test functions. """
from __future__ import absolute_import from __future__ import absolute_import
from __future__ import division from __future__ import division

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
""" discovery and running of std-library "unittest" style tests. """ """ discovery and running of std-library "unittest" style tests. """
from __future__ import absolute_import from __future__ import absolute_import
from __future__ import division from __future__ import division

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
import attr import attr

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import from __future__ import absolute_import
from __future__ import division from __future__ import division
from __future__ import print_function from __future__ import print_function

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
# PYTHON_ARGCOMPLETE_OK # PYTHON_ARGCOMPLETE_OK
""" """
pytest: unit and functional testing with Python. pytest: unit and functional testing with Python.

View File

@ -1,4 +1,4 @@
# coding: utf-8 # -*- coding: utf-8 -*-
from __future__ import absolute_import from __future__ import absolute_import
from __future__ import division from __future__ import division
from __future__ import print_function from __future__ import print_function

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
import pytest import pytest

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import from __future__ import absolute_import
from __future__ import division from __future__ import division
from __future__ import print_function from __future__ import print_function

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
"""Reproduces issue #3774""" """Reproduces issue #3774"""
try: try:

Some files were not shown because too many files have changed in this diff Show More