Skip to content

Commit 77c5191

Browse files
authored
Merge pull request #4953 from blueyed/merge-master-into-features
Merge master into features
2 parents a624b84 + 751c061 commit 77c5191

File tree

6 files changed

+22
-9
lines changed

6 files changed

+22
-9
lines changed

bench/bench.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import pytest # NOQA
66
import pstats
77

8-
script = sys.argv[1:] if len(sys.argv) > 1 else "empty.py"
8+
script = sys.argv[1:] if len(sys.argv) > 1 else ["empty.py"]
99
stats = cProfile.run("pytest.cmdline.main(%r)" % script, "prof")
1010
p = pstats.Stats("prof")
1111
p.strip_dirs()

changelog/4912.trivial.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
Remove deprecated Sphinx directive, ``add_description_unit()``.
1+
Remove deprecated Sphinx directive, ``add_description_unit()``,
2+
pin sphinx-removed-in to >= 0.2.0 to support Sphinx 2.0.

doc/en/reference.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,16 +199,18 @@ Marks a test function as *expected to fail*.
199199
.. py:function:: pytest.mark.xfail(condition=None, *, reason=None, raises=None, run=True, strict=False)
200200
201201
:type condition: bool or str
202-
:param condition: ``True/False`` if the condition should be marked as xfail or a :ref:`condition string <string conditions>`.
202+
:param condition:
203+
Condition for marking the test function as xfail (``True/False`` or a
204+
:ref:`condition string <string conditions>`).
203205
:keyword str reason: Reason why the test function is marked as xfail.
204206
:keyword Exception raises: Exception subclass expected to be raised by the test function; other exceptions will fail the test.
205207
:keyword bool run:
206208
If the test function should actually be executed. If ``False``, the function will always xfail and will
207-
not be executed (useful a function is segfaulting).
209+
not be executed (useful if a function is segfaulting).
208210
:keyword bool strict:
209211
* If ``False`` (the default) the function will be shown in the terminal output as ``xfailed`` if it fails
210212
and as ``xpass`` if it passes. In both cases this will not cause the test suite to fail as a whole. This
211-
is particularly useful to mark *flaky* tests (tests that random at fail) to be tackled later.
213+
is particularly useful to mark *flaky* tests (tests that fail at random) to be tackled later.
212214
* If ``True``, the function will be shown in the terminal output as ``xfailed`` if it fails, but if it
213215
unexpectedly passes then it will **fail** the test suite. This is particularly useful to mark functions
214216
that are always failing and there should be a clear indication if they unexpectedly start to pass (for example

doc/en/requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
pygments-pytest>=1.1.0
2-
sphinx>=1.8.2,<2.0
2+
sphinx>=1.8.2,<2.1
33
sphinxcontrib-trio
4-
sphinx-removed-in>=0.1.3
4+
sphinx-removed-in>=0.2.0

src/_pytest/capture.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,10 @@ def __init__(self, targetfd, tmpfile=None):
539539
self.tmpfile_fd = tmpfile.fileno()
540540

541541
def __repr__(self):
542-
return "<FDCapture %s oldfd=%s>" % (self.targetfd, self.targetfd_save)
542+
return "<FDCapture %s oldfd=%s>" % (
543+
self.targetfd,
544+
getattr(self, "targetfd_save", None),
545+
)
543546

544547
def start(self):
545548
""" Start capturing on targetfd using memorized tmpfile. """

testing/test_capture.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1231,20 +1231,27 @@ def test_stdcapture_fd_invalid_fd(self, testdir):
12311231
"""
12321232
import os
12331233
from _pytest import capture
1234+
12341235
def StdCaptureFD(out=True, err=True, in_=True):
12351236
return capture.MultiCapture(out, err, in_,
1236-
Capture=capture.FDCapture)
1237+
Capture=capture.FDCapture)
1238+
12371239
def test_stdout():
12381240
os.close(1)
12391241
cap = StdCaptureFD(out=True, err=False, in_=False)
1242+
assert repr(cap.out) == "<FDCapture 1 oldfd=None>"
12401243
cap.stop_capturing()
1244+
12411245
def test_stderr():
12421246
os.close(2)
12431247
cap = StdCaptureFD(out=False, err=True, in_=False)
1248+
assert repr(cap.err) == "<FDCapture 2 oldfd=None>"
12441249
cap.stop_capturing()
1250+
12451251
def test_stdin():
12461252
os.close(0)
12471253
cap = StdCaptureFD(out=False, err=False, in_=True)
1254+
assert repr(cap.in_) == "<FDCapture 0 oldfd=None>"
12481255
cap.stop_capturing()
12491256
"""
12501257
)

0 commit comments

Comments
 (0)