Skip to content

Commit e1ae469

Browse files
committed
Merge master into features
2 parents 4148663 + 3e1971e commit e1ae469

File tree

12 files changed

+39
-31
lines changed

12 files changed

+39
-31
lines changed

.coveragerc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[run]
22
include =
3-
*/src/*
3+
src/*
44
testing/*
55
*/lib/python*/site-packages/_pytest/*
66
*/lib/python*/site-packages/pytest.py

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ jobs:
7474
# Specialized factors for py37.
7575
# Coverage for:
7676
# - test_sys_breakpoint_interception (via pexpect).
77-
- env: TOXENV=py37-pexpect,py37-trial PYTEST_COVERAGE=1
77+
- env: TOXENV=py37-pexpect,py37-twisted PYTEST_COVERAGE=1
7878
- env: TOXENV=py37-pluggymaster-xdist
7979
- env: TOXENV=py37-freeze
8080

@@ -86,7 +86,7 @@ jobs:
8686
- stage: baseline
8787
# Coverage for:
8888
# - _pytest.unittest._handle_skip (via pexpect).
89-
env: TOXENV=py27-pexpect,py27-trial PYTEST_COVERAGE=1
89+
env: TOXENV=py27-pexpect,py27-twisted PYTEST_COVERAGE=1
9090
python: '2.7'
9191
# Use py36 here for faster baseline.
9292
- env: TOXENV=py36-xdist

azure-pipelines.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,17 @@ jobs:
3030
# - numpy
3131
# - pytester's LsofFdLeakChecker (being skipped)
3232
PYTEST_COVERAGE: '1'
33-
py27-trial:
33+
py27-twisted:
3434
python.version: '2.7'
35-
tox.env: 'py27-trial'
35+
tox.env: 'py27-twisted'
3636
python.needs_vc: True
3737
py27-pluggymaster-xdist:
3838
python.version: '2.7'
3939
tox.env: 'py27-pluggymaster-xdist'
4040
# Coverage for:
4141
# - except-IOError in _attempt_to_close_capture_file for py2.
4242
# Also seen with py27-nobyte (using xdist), and py27-xdist.
43-
# But no exception with py27-pexpect,py27-trial,py27-numpy.
43+
# But no exception with py27-pexpect,py27-twisted,py27-numpy.
4444
PYTEST_COVERAGE: '1'
4545
pypy:
4646
python.version: 'pypy'
@@ -76,9 +76,9 @@ jobs:
7676
py37-linting/docs/doctesting:
7777
python.version: '3.7'
7878
tox.env: 'linting,docs,doctesting'
79-
py37-trial/numpy:
79+
py37-twisted/numpy:
8080
python.version: '3.7'
81-
tox.env: 'py37-trial,py37-numpy'
81+
tox.env: 'py37-twisted,py37-numpy'
8282
py37-pluggymaster-xdist:
8383
python.version: '3.7'
8484
tox.env: 'py37-pluggymaster-xdist'

changelog/4928.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix line offsets with ``ScopeMismatch`` errors.

doc/en/reference.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -882,7 +882,7 @@ pytest_mark
882882
**Tutorial**: :ref:`scoped-marking`
883883

884884
Can be declared at the **global** level in *test modules* to apply one or more :ref:`marks <marks ref>` to all
885-
test functions and methods. Can be either a single mark or a sequence of marks.
885+
test functions and methods. Can be either a single mark or a list of marks.
886886

887887
.. code-block:: python
888888
@@ -895,7 +895,7 @@ test functions and methods. Can be either a single mark or a sequence of marks.
895895
896896
import pytest
897897
898-
pytestmark = (pytest.mark.integration, pytest.mark.slow)
898+
pytestmark = [pytest.mark.integration, pytest.mark.slow]
899899
900900
PYTEST_DONT_REWRITE (module docstring)
901901
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

src/_pytest/fixtures.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@ def _factorytraceback(self):
614614
fs, lineno = getfslineno(factory)
615615
p = self._pyfuncitem.session.fspath.bestrelpath(fs)
616616
args = _format_args(factory)
617-
lines.append("%s:%d: def %s%s" % (p, lineno, factory.__name__, args))
617+
lines.append("%s:%d: def %s%s" % (p, lineno + 1, factory.__name__, args))
618618
return lines
619619

620620
def _getscopeitem(self, scope):

src/_pytest/mark/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ def pytest_addoption(parser):
5252
"other' matches all test functions and classes whose name "
5353
"contains 'test_method' or 'test_other', while -k 'not test_method' "
5454
"matches those that don't contain 'test_method' in their names. "
55+
"-k 'not test_method and not test_other' will eliminate the matches. "
5556
"Additionally keywords are matched to classes and functions "
5657
"containing extra names in their 'extra_keyword_matches' set, "
5758
"as well as functions which have names assigned directly to them.",

testing/python/fixtures.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,8 +1030,8 @@ def test_add(arg2):
10301030
result.stdout.fnmatch_lines(
10311031
[
10321032
"*ScopeMismatch*involved factories*",
1033-
"* def arg2*",
1034-
"* def arg1*",
1033+
"test_receives_funcargs_scope_mismatch.py:6: def arg2(arg1)",
1034+
"test_receives_funcargs_scope_mismatch.py:2: def arg1()",
10351035
"*1 error*",
10361036
]
10371037
)
@@ -1141,6 +1141,7 @@ def __init__(self, request):
11411141
values = reprec.getfailedcollections()
11421142
assert len(values) == 1
11431143

1144+
@pytest.mark.filterwarnings("ignore::pytest.PytestDeprecationWarning")
11441145
def test_request_can_be_overridden(self, testdir):
11451146
testdir.makepyfile(
11461147
"""

testing/test_capture.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,12 +134,22 @@ def test_unicode():
134134
def test_collect_capturing(testdir):
135135
p = testdir.makepyfile(
136136
"""
137+
import sys
138+
137139
print("collect %s failure" % 13)
140+
sys.stderr.write("collect %s_stderr failure" % 13)
138141
import xyz42123
139142
"""
140143
)
141144
result = testdir.runpytest(p)
142-
result.stdout.fnmatch_lines(["*Captured stdout*", "*collect 13 failure*"])
145+
result.stdout.fnmatch_lines(
146+
[
147+
"*Captured stdout*",
148+
"collect 13 failure",
149+
"*Captured stderr*",
150+
"collect 13_stderr failure",
151+
]
152+
)
143153

144154

145155
class TestPerTestCapturing(object):

testing/test_session.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ def __repr__(self):
114114
class TestBrokenClass(object):
115115
def test_explicit_bad_repr(self):
116116
t = BrokenRepr1()
117-
pytest.raises(Exception, 'repr(t)')
117+
with pytest.raises(Exception, match="I'm a broken repr"):
118+
repr(t)
118119
119120
def test_implicit_bad_repr1(self):
120121
t = BrokenRepr1()

0 commit comments

Comments
 (0)