rename iocapture to capture, add/remove some missing files
--HG-- branch : 1.0.x
This commit is contained in:
parent
96c863b3c1
commit
1349edd3c6
|
@ -1,6 +1,6 @@
|
|||
|
||||
pytest_iocapture plugin
|
||||
=======================
|
||||
pytest_capture plugin
|
||||
=====================
|
||||
|
||||
configurable per-test stdout/stderr capturing mechanisms.
|
||||
|
||||
|
@ -122,8 +122,8 @@ Start improving this plugin in 30 seconds
|
|||
|
||||
Do you find the above documentation or the plugin itself lacking?
|
||||
|
||||
1. Download `pytest_iocapture.py`_ plugin source code
|
||||
2. put it somewhere as ``pytest_iocapture.py`` into your import path
|
||||
1. Download `pytest_capture.py`_ plugin source code
|
||||
2. put it somewhere as ``pytest_capture.py`` into your import path
|
||||
3. a subsequent ``py.test`` run will use your local version
|
||||
|
||||
Further information: extend_ documentation, other plugins_ or contact_.
|
|
@ -8,7 +8,7 @@ figleaf_ write and report coverage data with 'figleaf'.
|
|||
|
||||
monkeypatch_ safely patch object attributes, dicts and environment variables.
|
||||
|
||||
iocapture_ configurable per-test stdout/stderr capturing mechanisms.
|
||||
capture_ configurable per-test stdout/stderr capturing mechanisms.
|
||||
|
||||
recwarn_ helpers for asserting deprecation and other warnings.
|
||||
|
||||
|
|
|
@ -1,33 +1,33 @@
|
|||
.. _`pytest_recwarn.py`: http://bitbucket.org/hpk42/py-trunk/raw/6f105e72c160bd25ad7bbd4d30b1e4e92f275939/py/test/plugin/pytest_recwarn.py
|
||||
.. _`pytest_iocapture.py`: http://bitbucket.org/hpk42/py-trunk/raw/6f105e72c160bd25ad7bbd4d30b1e4e92f275939/py/test/plugin/pytest_iocapture.py
|
||||
.. _`pytest_monkeypatch.py`: http://bitbucket.org/hpk42/py-trunk/raw/6f105e72c160bd25ad7bbd4d30b1e4e92f275939/py/test/plugin/pytest_monkeypatch.py
|
||||
.. _`pytest_keyword.py`: http://bitbucket.org/hpk42/py-trunk/raw/6f105e72c160bd25ad7bbd4d30b1e4e92f275939/py/test/plugin/pytest_keyword.py
|
||||
.. _`terminal`: terminal.html
|
||||
.. _`pytest_recwarn.py`: http://bitbucket.org/hpk42/py-trunk/raw/e9bce7c38c26d789a83bc0e9db7c4b8366e44cc1/py/test/plugin/pytest_recwarn.py
|
||||
.. _`unittest`: unittest.html
|
||||
.. _`pytest_monkeypatch.py`: http://bitbucket.org/hpk42/py-trunk/raw/e9bce7c38c26d789a83bc0e9db7c4b8366e44cc1/py/test/plugin/pytest_monkeypatch.py
|
||||
.. _`pytest_keyword.py`: http://bitbucket.org/hpk42/py-trunk/raw/e9bce7c38c26d789a83bc0e9db7c4b8366e44cc1/py/test/plugin/pytest_keyword.py
|
||||
.. _`pastebin`: pastebin.html
|
||||
.. _`plugins`: index.html
|
||||
.. _`pytest_doctest.py`: http://bitbucket.org/hpk42/py-trunk/raw/6f105e72c160bd25ad7bbd4d30b1e4e92f275939/py/test/plugin/pytest_doctest.py
|
||||
.. _`terminal`: terminal.html
|
||||
.. _`pytest_capture.py`: http://bitbucket.org/hpk42/py-trunk/raw/e9bce7c38c26d789a83bc0e9db7c4b8366e44cc1/py/test/plugin/pytest_capture.py
|
||||
.. _`pytest_doctest.py`: http://bitbucket.org/hpk42/py-trunk/raw/e9bce7c38c26d789a83bc0e9db7c4b8366e44cc1/py/test/plugin/pytest_doctest.py
|
||||
.. _`capture`: capture.html
|
||||
.. _`hooklog`: hooklog.html
|
||||
.. _`pytest_restdoc.py`: http://bitbucket.org/hpk42/py-trunk/raw/6f105e72c160bd25ad7bbd4d30b1e4e92f275939/py/test/plugin/pytest_restdoc.py
|
||||
.. _`pytest_hooklog.py`: http://bitbucket.org/hpk42/py-trunk/raw/6f105e72c160bd25ad7bbd4d30b1e4e92f275939/py/test/plugin/pytest_hooklog.py
|
||||
.. _`pytest_pastebin.py`: http://bitbucket.org/hpk42/py-trunk/raw/6f105e72c160bd25ad7bbd4d30b1e4e92f275939/py/test/plugin/pytest_pastebin.py
|
||||
.. _`pytest_figleaf.py`: http://bitbucket.org/hpk42/py-trunk/raw/6f105e72c160bd25ad7bbd4d30b1e4e92f275939/py/test/plugin/pytest_figleaf.py
|
||||
.. _`pytest_restdoc.py`: http://bitbucket.org/hpk42/py-trunk/raw/e9bce7c38c26d789a83bc0e9db7c4b8366e44cc1/py/test/plugin/pytest_restdoc.py
|
||||
.. _`pytest_hooklog.py`: http://bitbucket.org/hpk42/py-trunk/raw/e9bce7c38c26d789a83bc0e9db7c4b8366e44cc1/py/test/plugin/pytest_hooklog.py
|
||||
.. _`pytest_pastebin.py`: http://bitbucket.org/hpk42/py-trunk/raw/e9bce7c38c26d789a83bc0e9db7c4b8366e44cc1/py/test/plugin/pytest_pastebin.py
|
||||
.. _`pytest_figleaf.py`: http://bitbucket.org/hpk42/py-trunk/raw/e9bce7c38c26d789a83bc0e9db7c4b8366e44cc1/py/test/plugin/pytest_figleaf.py
|
||||
.. _`xfail`: xfail.html
|
||||
.. _`contact`: ../../contact.html
|
||||
.. _`checkout the py.test development version`: ../../download.html#checkout
|
||||
.. _`oejskit`: oejskit.html
|
||||
.. _`unittest`: unittest.html
|
||||
.. _`iocapture`: iocapture.html
|
||||
.. _`pytest_xfail.py`: http://bitbucket.org/hpk42/py-trunk/raw/6f105e72c160bd25ad7bbd4d30b1e4e92f275939/py/test/plugin/pytest_xfail.py
|
||||
.. _`pytest_xfail.py`: http://bitbucket.org/hpk42/py-trunk/raw/e9bce7c38c26d789a83bc0e9db7c4b8366e44cc1/py/test/plugin/pytest_xfail.py
|
||||
.. _`figleaf`: figleaf.html
|
||||
.. _`extend`: ../extend.html
|
||||
.. _`pytest_terminal.py`: http://bitbucket.org/hpk42/py-trunk/raw/6f105e72c160bd25ad7bbd4d30b1e4e92f275939/py/test/plugin/pytest_terminal.py
|
||||
.. _`pytest_terminal.py`: http://bitbucket.org/hpk42/py-trunk/raw/e9bce7c38c26d789a83bc0e9db7c4b8366e44cc1/py/test/plugin/pytest_terminal.py
|
||||
.. _`recwarn`: recwarn.html
|
||||
.. _`pytest_pdb.py`: http://bitbucket.org/hpk42/py-trunk/raw/6f105e72c160bd25ad7bbd4d30b1e4e92f275939/py/test/plugin/pytest_pdb.py
|
||||
.. _`pytest_pdb.py`: http://bitbucket.org/hpk42/py-trunk/raw/e9bce7c38c26d789a83bc0e9db7c4b8366e44cc1/py/test/plugin/pytest_pdb.py
|
||||
.. _`monkeypatch`: monkeypatch.html
|
||||
.. _`resultlog`: resultlog.html
|
||||
.. _`keyword`: keyword.html
|
||||
.. _`restdoc`: restdoc.html
|
||||
.. _`pytest_unittest.py`: http://bitbucket.org/hpk42/py-trunk/raw/6f105e72c160bd25ad7bbd4d30b1e4e92f275939/py/test/plugin/pytest_unittest.py
|
||||
.. _`pytest_unittest.py`: http://bitbucket.org/hpk42/py-trunk/raw/e9bce7c38c26d789a83bc0e9db7c4b8366e44cc1/py/test/plugin/pytest_unittest.py
|
||||
.. _`doctest`: doctest.html
|
||||
.. _`pytest_resultlog.py`: http://bitbucket.org/hpk42/py-trunk/raw/6f105e72c160bd25ad7bbd4d30b1e4e92f275939/py/test/plugin/pytest_resultlog.py
|
||||
.. _`pytest_resultlog.py`: http://bitbucket.org/hpk42/py-trunk/raw/e9bce7c38c26d789a83bc0e9db7c4b8366e44cc1/py/test/plugin/pytest_resultlog.py
|
||||
.. _`pdb`: pdb.html
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
|
||||
pytest_pastebin plugin
|
||||
======================
|
||||
|
||||
submit failure or test session information to a pastebin service.
|
||||
|
||||
.. contents::
|
||||
:local:
|
||||
|
||||
Usage
|
||||
----------
|
||||
|
||||
**Creating a URL for each test failure**::
|
||||
|
||||
py.test --pastebin=failed
|
||||
|
||||
This will submit full failure information to a remote Paste service and
|
||||
provide a URL for each failure. You may select tests as usual or add
|
||||
for example ``-x`` if you only want to send one particular failure.
|
||||
|
||||
**Creating a URL for a whole test session log**::
|
||||
|
||||
py.test --pastebin=all
|
||||
|
||||
Currently only pasting to the http://paste.pocoo.org service is implemented.
|
||||
|
||||
command line options
|
||||
--------------------
|
||||
|
||||
|
||||
``--pastebin=mode``
|
||||
send failed|all info to Pocoo pastebin service.
|
||||
|
||||
Start improving this plugin in 30 seconds
|
||||
=========================================
|
||||
|
||||
|
||||
Do you find the above documentation or the plugin itself lacking?
|
||||
|
||||
1. Download `pytest_pastebin.py`_ plugin source code
|
||||
2. put it somewhere as ``pytest_pastebin.py`` into your import path
|
||||
3. a subsequent ``py.test`` run will use your local version
|
||||
|
||||
Further information: extend_ documentation, other plugins_ or contact_.
|
||||
|
||||
.. include:: links.txt
|
|
@ -5,7 +5,7 @@ WIDTH = 75
|
|||
|
||||
plugins = [
|
||||
('Plugins related to Python test functions and programs',
|
||||
'xfail figleaf monkeypatch iocapture recwarn',),
|
||||
'xfail figleaf monkeypatch capture recwarn',),
|
||||
('Plugins for other testing styles and languages',
|
||||
'unittest doctest oejskit restdoc'),
|
||||
('Plugins for generic reporting and failure logging',
|
||||
|
|
|
@ -10,6 +10,6 @@ Generator = py.test.collect.Generator
|
|||
Function = py.test.collect.Function
|
||||
Instance = py.test.collect.Instance
|
||||
|
||||
pytest_plugins = "default runner iocapture terminal keyword xfail tmpdir execnetcleanup monkeypatch recwarn pdb pastebin unittest".split()
|
||||
pytest_plugins = "default runner capture terminal keyword xfail tmpdir execnetcleanup monkeypatch recwarn pdb pastebin unittest".split()
|
||||
|
||||
conf_capture = "fd"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import py, os, sys
|
||||
from py.__.test.plugin.pytest_iocapture import CaptureManager
|
||||
from py.__.test.plugin.pytest_capture import CaptureManager
|
||||
|
||||
class TestCaptureManager:
|
||||
|
||||
|
@ -88,6 +88,31 @@ class TestPerTestCapturing:
|
|||
"in func2*",
|
||||
])
|
||||
|
||||
@py.test.mark.xfail
|
||||
def test_capture_scope_cache(self, testdir):
|
||||
p = testdir.makepyfile("""
|
||||
import sys
|
||||
def setup_module(func):
|
||||
print "module-setup"
|
||||
def setup_function(func):
|
||||
print "function-setup"
|
||||
def test_func():
|
||||
print "in function"
|
||||
assert 0
|
||||
def teardown_function(func):
|
||||
print "in teardown"
|
||||
""")
|
||||
result = testdir.runpytest(p)
|
||||
result.stdout.fnmatch_lines([
|
||||
"*test_func():*",
|
||||
"*Captured stdout during setup*",
|
||||
"module-setup*",
|
||||
"function-setup*",
|
||||
"*Captured stdout*",
|
||||
"in teardown*",
|
||||
])
|
||||
|
||||
|
||||
def test_no_carry_over(self, testdir):
|
||||
p = testdir.makepyfile("""
|
||||
def test_func1():
|
||||
|
@ -230,9 +255,7 @@ class TestLoggingInteraction:
|
|||
# verify proper termination
|
||||
assert "closed" not in s
|
||||
|
||||
@py.test.mark.xfail
|
||||
def test_logging_and_crossscope_fixtures(self, testdir):
|
||||
# XXX also needs final teardown reporting to work!
|
||||
p = testdir.makepyfile("""
|
||||
import logging
|
||||
def setup_module(function):
|
||||
|
@ -246,14 +269,14 @@ class TestLoggingInteraction:
|
|||
logging.warn("hello3")
|
||||
assert 0
|
||||
""")
|
||||
for optargs in (('--iocapture=sys',), ('--iocapture=fd',)):
|
||||
for optargs in (('--capture=sys',), ('--capture=fd',)):
|
||||
print optargs
|
||||
result = testdir.runpytest(p, *optargs)
|
||||
s = result.stdout.str()
|
||||
result.stdout.fnmatch_lines([
|
||||
"*WARN*hello3", # errors come first
|
||||
"*WARN*hello1",
|
||||
"*WARN*hello2",
|
||||
"*WARN*hello3",
|
||||
])
|
||||
# verify proper termination
|
||||
assert "closed" not in s
|
||||
|
@ -303,5 +326,3 @@ class TestCaptureFuncarg:
|
|||
])
|
||||
assert result.ret == 2
|
||||
|
||||
|
||||
|
|
@ -193,24 +193,6 @@ class BaseFunctionalTests:
|
|||
else:
|
||||
py.test.fail("did not raise")
|
||||
|
||||
@py.test.mark.xfail
|
||||
def test_capture_per_func(self, testdir):
|
||||
reports = testdir.runitem("""
|
||||
import sys
|
||||
def setup_function(func):
|
||||
print "in setup"
|
||||
def test_func():
|
||||
print "in function"
|
||||
assert 0
|
||||
def teardown_function(func):
|
||||
print "in teardown"
|
||||
""")
|
||||
assert reports[0].outerr[0] == "in setup\n"
|
||||
assert reports[1].outerr[0] == "in function\n"
|
||||
assert reports[2].outerr[0] == "in teardown\n"
|
||||
|
||||
|
||||
|
||||
class TestExecutionNonForked(BaseFunctionalTests):
|
||||
def getrunner(self):
|
||||
def f(item):
|
||||
|
|
Loading…
Reference in New Issue