Merge pull request #4953 from blueyed/merge-master-into-features
Merge master into features
This commit is contained in:
commit
77c5191ad7
|
@ -5,7 +5,7 @@ if __name__ == "__main__":
|
||||||
import pytest # NOQA
|
import pytest # NOQA
|
||||||
import pstats
|
import pstats
|
||||||
|
|
||||||
script = sys.argv[1:] if len(sys.argv) > 1 else "empty.py"
|
script = sys.argv[1:] if len(sys.argv) > 1 else ["empty.py"]
|
||||||
stats = cProfile.run("pytest.cmdline.main(%r)" % script, "prof")
|
stats = cProfile.run("pytest.cmdline.main(%r)" % script, "prof")
|
||||||
p = pstats.Stats("prof")
|
p = pstats.Stats("prof")
|
||||||
p.strip_dirs()
|
p.strip_dirs()
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
Remove deprecated Sphinx directive, ``add_description_unit()``.
|
Remove deprecated Sphinx directive, ``add_description_unit()``,
|
||||||
|
pin sphinx-removed-in to >= 0.2.0 to support Sphinx 2.0.
|
||||||
|
|
|
@ -199,16 +199,18 @@ Marks a test function as *expected to fail*.
|
||||||
.. py:function:: pytest.mark.xfail(condition=None, *, reason=None, raises=None, run=True, strict=False)
|
.. py:function:: pytest.mark.xfail(condition=None, *, reason=None, raises=None, run=True, strict=False)
|
||||||
|
|
||||||
:type condition: bool or str
|
:type condition: bool or str
|
||||||
:param condition: ``True/False`` if the condition should be marked as xfail or a :ref:`condition string <string conditions>`.
|
:param condition:
|
||||||
|
Condition for marking the test function as xfail (``True/False`` or a
|
||||||
|
:ref:`condition string <string conditions>`).
|
||||||
:keyword str reason: Reason why the test function is marked as xfail.
|
:keyword str reason: Reason why the test function is marked as xfail.
|
||||||
:keyword Exception raises: Exception subclass expected to be raised by the test function; other exceptions will fail the test.
|
:keyword Exception raises: Exception subclass expected to be raised by the test function; other exceptions will fail the test.
|
||||||
:keyword bool run:
|
:keyword bool run:
|
||||||
If the test function should actually be executed. If ``False``, the function will always xfail and will
|
If the test function should actually be executed. If ``False``, the function will always xfail and will
|
||||||
not be executed (useful a function is segfaulting).
|
not be executed (useful if a function is segfaulting).
|
||||||
:keyword bool strict:
|
:keyword bool strict:
|
||||||
* If ``False`` (the default) the function will be shown in the terminal output as ``xfailed`` if it fails
|
* If ``False`` (the default) the function will be shown in the terminal output as ``xfailed`` if it fails
|
||||||
and as ``xpass`` if it passes. In both cases this will not cause the test suite to fail as a whole. This
|
and as ``xpass`` if it passes. In both cases this will not cause the test suite to fail as a whole. This
|
||||||
is particularly useful to mark *flaky* tests (tests that random at fail) to be tackled later.
|
is particularly useful to mark *flaky* tests (tests that fail at random) to be tackled later.
|
||||||
* If ``True``, the function will be shown in the terminal output as ``xfailed`` if it fails, but if it
|
* If ``True``, the function will be shown in the terminal output as ``xfailed`` if it fails, but if it
|
||||||
unexpectedly passes then it will **fail** the test suite. This is particularly useful to mark functions
|
unexpectedly passes then it will **fail** the test suite. This is particularly useful to mark functions
|
||||||
that are always failing and there should be a clear indication if they unexpectedly start to pass (for example
|
that are always failing and there should be a clear indication if they unexpectedly start to pass (for example
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
pygments-pytest>=1.1.0
|
pygments-pytest>=1.1.0
|
||||||
sphinx>=1.8.2,<2.0
|
sphinx>=1.8.2,<2.1
|
||||||
sphinxcontrib-trio
|
sphinxcontrib-trio
|
||||||
sphinx-removed-in>=0.1.3
|
sphinx-removed-in>=0.2.0
|
||||||
|
|
|
@ -539,7 +539,10 @@ class FDCaptureBinary(object):
|
||||||
self.tmpfile_fd = tmpfile.fileno()
|
self.tmpfile_fd = tmpfile.fileno()
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return "<FDCapture %s oldfd=%s>" % (self.targetfd, self.targetfd_save)
|
return "<FDCapture %s oldfd=%s>" % (
|
||||||
|
self.targetfd,
|
||||||
|
getattr(self, "targetfd_save", None),
|
||||||
|
)
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
""" Start capturing on targetfd using memorized tmpfile. """
|
""" Start capturing on targetfd using memorized tmpfile. """
|
||||||
|
|
|
@ -1231,20 +1231,27 @@ class TestStdCaptureFDinvalidFD(object):
|
||||||
"""
|
"""
|
||||||
import os
|
import os
|
||||||
from _pytest import capture
|
from _pytest import capture
|
||||||
|
|
||||||
def StdCaptureFD(out=True, err=True, in_=True):
|
def StdCaptureFD(out=True, err=True, in_=True):
|
||||||
return capture.MultiCapture(out, err, in_,
|
return capture.MultiCapture(out, err, in_,
|
||||||
Capture=capture.FDCapture)
|
Capture=capture.FDCapture)
|
||||||
|
|
||||||
def test_stdout():
|
def test_stdout():
|
||||||
os.close(1)
|
os.close(1)
|
||||||
cap = StdCaptureFD(out=True, err=False, in_=False)
|
cap = StdCaptureFD(out=True, err=False, in_=False)
|
||||||
|
assert repr(cap.out) == "<FDCapture 1 oldfd=None>"
|
||||||
cap.stop_capturing()
|
cap.stop_capturing()
|
||||||
|
|
||||||
def test_stderr():
|
def test_stderr():
|
||||||
os.close(2)
|
os.close(2)
|
||||||
cap = StdCaptureFD(out=False, err=True, in_=False)
|
cap = StdCaptureFD(out=False, err=True, in_=False)
|
||||||
|
assert repr(cap.err) == "<FDCapture 2 oldfd=None>"
|
||||||
cap.stop_capturing()
|
cap.stop_capturing()
|
||||||
|
|
||||||
def test_stdin():
|
def test_stdin():
|
||||||
os.close(0)
|
os.close(0)
|
||||||
cap = StdCaptureFD(out=False, err=False, in_=True)
|
cap = StdCaptureFD(out=False, err=False, in_=True)
|
||||||
|
assert repr(cap.in_) == "<FDCapture 0 oldfd=None>"
|
||||||
cap.stop_capturing()
|
cap.stop_capturing()
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue