Merge master into features
This commit is contained in:
commit
e1ae469504
|
@ -1,6 +1,6 @@
|
||||||
[run]
|
[run]
|
||||||
include =
|
include =
|
||||||
*/src/*
|
src/*
|
||||||
testing/*
|
testing/*
|
||||||
*/lib/python*/site-packages/_pytest/*
|
*/lib/python*/site-packages/_pytest/*
|
||||||
*/lib/python*/site-packages/pytest.py
|
*/lib/python*/site-packages/pytest.py
|
||||||
|
|
|
@ -74,7 +74,7 @@ jobs:
|
||||||
# Specialized factors for py37.
|
# Specialized factors for py37.
|
||||||
# Coverage for:
|
# Coverage for:
|
||||||
# - test_sys_breakpoint_interception (via pexpect).
|
# - test_sys_breakpoint_interception (via pexpect).
|
||||||
- env: TOXENV=py37-pexpect,py37-trial PYTEST_COVERAGE=1
|
- env: TOXENV=py37-pexpect,py37-twisted PYTEST_COVERAGE=1
|
||||||
- env: TOXENV=py37-pluggymaster-xdist
|
- env: TOXENV=py37-pluggymaster-xdist
|
||||||
- env: TOXENV=py37-freeze
|
- env: TOXENV=py37-freeze
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ jobs:
|
||||||
- stage: baseline
|
- stage: baseline
|
||||||
# Coverage for:
|
# Coverage for:
|
||||||
# - _pytest.unittest._handle_skip (via pexpect).
|
# - _pytest.unittest._handle_skip (via pexpect).
|
||||||
env: TOXENV=py27-pexpect,py27-trial PYTEST_COVERAGE=1
|
env: TOXENV=py27-pexpect,py27-twisted PYTEST_COVERAGE=1
|
||||||
python: '2.7'
|
python: '2.7'
|
||||||
# Use py36 here for faster baseline.
|
# Use py36 here for faster baseline.
|
||||||
- env: TOXENV=py36-xdist
|
- env: TOXENV=py36-xdist
|
||||||
|
|
|
@ -30,9 +30,9 @@ jobs:
|
||||||
# - numpy
|
# - numpy
|
||||||
# - pytester's LsofFdLeakChecker (being skipped)
|
# - pytester's LsofFdLeakChecker (being skipped)
|
||||||
PYTEST_COVERAGE: '1'
|
PYTEST_COVERAGE: '1'
|
||||||
py27-trial:
|
py27-twisted:
|
||||||
python.version: '2.7'
|
python.version: '2.7'
|
||||||
tox.env: 'py27-trial'
|
tox.env: 'py27-twisted'
|
||||||
python.needs_vc: True
|
python.needs_vc: True
|
||||||
py27-pluggymaster-xdist:
|
py27-pluggymaster-xdist:
|
||||||
python.version: '2.7'
|
python.version: '2.7'
|
||||||
|
@ -40,7 +40,7 @@ jobs:
|
||||||
# Coverage for:
|
# Coverage for:
|
||||||
# - except-IOError in _attempt_to_close_capture_file for py2.
|
# - except-IOError in _attempt_to_close_capture_file for py2.
|
||||||
# Also seen with py27-nobyte (using xdist), and py27-xdist.
|
# Also seen with py27-nobyte (using xdist), and py27-xdist.
|
||||||
# But no exception with py27-pexpect,py27-trial,py27-numpy.
|
# But no exception with py27-pexpect,py27-twisted,py27-numpy.
|
||||||
PYTEST_COVERAGE: '1'
|
PYTEST_COVERAGE: '1'
|
||||||
pypy:
|
pypy:
|
||||||
python.version: 'pypy'
|
python.version: 'pypy'
|
||||||
|
@ -76,9 +76,9 @@ jobs:
|
||||||
py37-linting/docs/doctesting:
|
py37-linting/docs/doctesting:
|
||||||
python.version: '3.7'
|
python.version: '3.7'
|
||||||
tox.env: 'linting,docs,doctesting'
|
tox.env: 'linting,docs,doctesting'
|
||||||
py37-trial/numpy:
|
py37-twisted/numpy:
|
||||||
python.version: '3.7'
|
python.version: '3.7'
|
||||||
tox.env: 'py37-trial,py37-numpy'
|
tox.env: 'py37-twisted,py37-numpy'
|
||||||
py37-pluggymaster-xdist:
|
py37-pluggymaster-xdist:
|
||||||
python.version: '3.7'
|
python.version: '3.7'
|
||||||
tox.env: 'py37-pluggymaster-xdist'
|
tox.env: 'py37-pluggymaster-xdist'
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Fix line offsets with ``ScopeMismatch`` errors.
|
|
@ -882,7 +882,7 @@ pytest_mark
|
||||||
**Tutorial**: :ref:`scoped-marking`
|
**Tutorial**: :ref:`scoped-marking`
|
||||||
|
|
||||||
Can be declared at the **global** level in *test modules* to apply one or more :ref:`marks <marks ref>` to all
|
Can be declared at the **global** level in *test modules* to apply one or more :ref:`marks <marks ref>` to all
|
||||||
test functions and methods. Can be either a single mark or a sequence of marks.
|
test functions and methods. Can be either a single mark or a list of marks.
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
|
@ -895,7 +895,7 @@ test functions and methods. Can be either a single mark or a sequence of marks.
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
pytestmark = (pytest.mark.integration, pytest.mark.slow)
|
pytestmark = [pytest.mark.integration, pytest.mark.slow]
|
||||||
|
|
||||||
PYTEST_DONT_REWRITE (module docstring)
|
PYTEST_DONT_REWRITE (module docstring)
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
|
@ -614,7 +614,7 @@ class FixtureRequest(FuncargnamesCompatAttr):
|
||||||
fs, lineno = getfslineno(factory)
|
fs, lineno = getfslineno(factory)
|
||||||
p = self._pyfuncitem.session.fspath.bestrelpath(fs)
|
p = self._pyfuncitem.session.fspath.bestrelpath(fs)
|
||||||
args = _format_args(factory)
|
args = _format_args(factory)
|
||||||
lines.append("%s:%d: def %s%s" % (p, lineno, factory.__name__, args))
|
lines.append("%s:%d: def %s%s" % (p, lineno + 1, factory.__name__, args))
|
||||||
return lines
|
return lines
|
||||||
|
|
||||||
def _getscopeitem(self, scope):
|
def _getscopeitem(self, scope):
|
||||||
|
|
|
@ -52,6 +52,7 @@ def pytest_addoption(parser):
|
||||||
"other' matches all test functions and classes whose name "
|
"other' matches all test functions and classes whose name "
|
||||||
"contains 'test_method' or 'test_other', while -k 'not test_method' "
|
"contains 'test_method' or 'test_other', while -k 'not test_method' "
|
||||||
"matches those that don't contain 'test_method' in their names. "
|
"matches those that don't contain 'test_method' in their names. "
|
||||||
|
"-k 'not test_method and not test_other' will eliminate the matches. "
|
||||||
"Additionally keywords are matched to classes and functions "
|
"Additionally keywords are matched to classes and functions "
|
||||||
"containing extra names in their 'extra_keyword_matches' set, "
|
"containing extra names in their 'extra_keyword_matches' set, "
|
||||||
"as well as functions which have names assigned directly to them.",
|
"as well as functions which have names assigned directly to them.",
|
||||||
|
|
|
@ -1030,8 +1030,8 @@ class TestFixtureUsages(object):
|
||||||
result.stdout.fnmatch_lines(
|
result.stdout.fnmatch_lines(
|
||||||
[
|
[
|
||||||
"*ScopeMismatch*involved factories*",
|
"*ScopeMismatch*involved factories*",
|
||||||
"* def arg2*",
|
"test_receives_funcargs_scope_mismatch.py:6: def arg2(arg1)",
|
||||||
"* def arg1*",
|
"test_receives_funcargs_scope_mismatch.py:2: def arg1()",
|
||||||
"*1 error*",
|
"*1 error*",
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
@ -1141,6 +1141,7 @@ class TestFixtureUsages(object):
|
||||||
values = reprec.getfailedcollections()
|
values = reprec.getfailedcollections()
|
||||||
assert len(values) == 1
|
assert len(values) == 1
|
||||||
|
|
||||||
|
@pytest.mark.filterwarnings("ignore::pytest.PytestDeprecationWarning")
|
||||||
def test_request_can_be_overridden(self, testdir):
|
def test_request_can_be_overridden(self, testdir):
|
||||||
testdir.makepyfile(
|
testdir.makepyfile(
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -134,12 +134,22 @@ def test_capturing_bytes_in_utf8_encoding(testdir, method):
|
||||||
def test_collect_capturing(testdir):
|
def test_collect_capturing(testdir):
|
||||||
p = testdir.makepyfile(
|
p = testdir.makepyfile(
|
||||||
"""
|
"""
|
||||||
|
import sys
|
||||||
|
|
||||||
print("collect %s failure" % 13)
|
print("collect %s failure" % 13)
|
||||||
|
sys.stderr.write("collect %s_stderr failure" % 13)
|
||||||
import xyz42123
|
import xyz42123
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
result = testdir.runpytest(p)
|
result = testdir.runpytest(p)
|
||||||
result.stdout.fnmatch_lines(["*Captured stdout*", "*collect 13 failure*"])
|
result.stdout.fnmatch_lines(
|
||||||
|
[
|
||||||
|
"*Captured stdout*",
|
||||||
|
"collect 13 failure",
|
||||||
|
"*Captured stderr*",
|
||||||
|
"collect 13_stderr failure",
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class TestPerTestCapturing(object):
|
class TestPerTestCapturing(object):
|
||||||
|
|
|
@ -114,7 +114,8 @@ class SessionTests(object):
|
||||||
class TestBrokenClass(object):
|
class TestBrokenClass(object):
|
||||||
def test_explicit_bad_repr(self):
|
def test_explicit_bad_repr(self):
|
||||||
t = BrokenRepr1()
|
t = BrokenRepr1()
|
||||||
pytest.raises(Exception, 'repr(t)')
|
with pytest.raises(Exception, match="I'm a broken repr"):
|
||||||
|
repr(t)
|
||||||
|
|
||||||
def test_implicit_bad_repr1(self):
|
def test_implicit_bad_repr1(self):
|
||||||
t = BrokenRepr1()
|
t = BrokenRepr1()
|
||||||
|
|
|
@ -95,10 +95,12 @@ def test_as_errors(testdir, pyfile_with_warnings, method):
|
||||||
testdir.makeini(
|
testdir.makeini(
|
||||||
"""
|
"""
|
||||||
[pytest]
|
[pytest]
|
||||||
filterwarnings= error
|
filterwarnings=error
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
result = testdir.runpytest(*args)
|
# Use a subprocess, since changing logging level affects other threads
|
||||||
|
# (xdist).
|
||||||
|
result = testdir.runpytest_subprocess(*args)
|
||||||
result.stdout.fnmatch_lines(
|
result.stdout.fnmatch_lines(
|
||||||
[
|
[
|
||||||
"E UserWarning: user warning",
|
"E UserWarning: user warning",
|
||||||
|
|
20
tox.ini
20
tox.ini
|
@ -13,7 +13,7 @@ envlist =
|
||||||
py38
|
py38
|
||||||
pypy
|
pypy
|
||||||
pypy3
|
pypy3
|
||||||
{py27,py37}-{pexpect,xdist,trial,numpy,pluggymaster}
|
{py27,py37}-{pexpect,xdist,twisted,numpy,pluggymaster}
|
||||||
py27-nobyte-xdist
|
py27-nobyte-xdist
|
||||||
doctesting
|
doctesting
|
||||||
py37-freeze
|
py37-freeze
|
||||||
|
@ -26,7 +26,7 @@ commands =
|
||||||
coverage: coverage report
|
coverage: coverage report
|
||||||
passenv = USER USERNAME COVERAGE_* TRAVIS PYTEST_ADDOPTS
|
passenv = USER USERNAME COVERAGE_* TRAVIS PYTEST_ADDOPTS
|
||||||
setenv =
|
setenv =
|
||||||
_PYTEST_TOX_DEFAULT_POSARGS={env:_PYTEST_TOX_POSARGS_LSOF:} {env:_PYTEST_TOX_POSARGS_PEXPECT:} {env:_PYTEST_TOX_POSARGS_XDIST:}
|
_PYTEST_TOX_DEFAULT_POSARGS={env:_PYTEST_TOX_POSARGS_LSOF:} {env:_PYTEST_TOX_POSARGS_PEXPECT:} {env:_PYTEST_TOX_POSARGS_TWISTED:} {env:_PYTEST_TOX_POSARGS_XDIST:}
|
||||||
|
|
||||||
# Configuration to run with coverage similar to Travis/Appveyor, e.g.
|
# Configuration to run with coverage similar to Travis/Appveyor, e.g.
|
||||||
# "tox -e py37-coverage".
|
# "tox -e py37-coverage".
|
||||||
|
@ -42,12 +42,16 @@ setenv =
|
||||||
pexpect: _PYTEST_TOX_PLATFORM=linux|darwin
|
pexpect: _PYTEST_TOX_PLATFORM=linux|darwin
|
||||||
pexpect: _PYTEST_TOX_POSARGS_PEXPECT=testing/test_pdb.py testing/test_terminal.py testing/test_unittest.py
|
pexpect: _PYTEST_TOX_POSARGS_PEXPECT=testing/test_pdb.py testing/test_terminal.py testing/test_unittest.py
|
||||||
|
|
||||||
|
twisted: _PYTEST_TOX_POSARGS_TWISTED=testing/test_unittest.py
|
||||||
|
|
||||||
xdist: _PYTEST_TOX_POSARGS_XDIST=-n auto
|
xdist: _PYTEST_TOX_POSARGS_XDIST=-n auto
|
||||||
extras = testing
|
extras = testing
|
||||||
deps =
|
deps =
|
||||||
numpy: numpy
|
numpy: numpy
|
||||||
pexpect: pexpect
|
pexpect: pexpect
|
||||||
pluggymaster: git+https://github.com/pytest-dev/pluggy.git@master
|
pluggymaster: git+https://github.com/pytest-dev/pluggy.git@master
|
||||||
|
twisted: twisted
|
||||||
|
twisted: unittest2
|
||||||
xdist: pytest-xdist>=1.13
|
xdist: pytest-xdist>=1.13
|
||||||
{env:_PYTEST_TOX_EXTRA_DEP:}
|
{env:_PYTEST_TOX_EXTRA_DEP:}
|
||||||
platform = {env:_PYTEST_TOX_PLATFORM:.*}
|
platform = {env:_PYTEST_TOX_PLATFORM:.*}
|
||||||
|
@ -67,18 +71,6 @@ basepython = python3
|
||||||
deps = pre-commit>=1.11.0
|
deps = pre-commit>=1.11.0
|
||||||
commands = pre-commit run --all-files --show-diff-on-failure
|
commands = pre-commit run --all-files --show-diff-on-failure
|
||||||
|
|
||||||
[testenv:py27-trial]
|
|
||||||
deps =
|
|
||||||
{[testenv]deps}
|
|
||||||
twisted
|
|
||||||
unittest2
|
|
||||||
commands =
|
|
||||||
{env:_PYTEST_TOX_COVERAGE_RUN:} pytest {posargs:testing/test_unittest.py}
|
|
||||||
|
|
||||||
[testenv:py37-trial]
|
|
||||||
deps = {[testenv:py27-trial]deps}
|
|
||||||
commands = {[testenv:py27-trial]commands}
|
|
||||||
|
|
||||||
[testenv:docs]
|
[testenv:docs]
|
||||||
basepython = python3
|
basepython = python3
|
||||||
usedevelop = True
|
usedevelop = True
|
||||||
|
|
Loading…
Reference in New Issue