regen setup.py and docs so that "python3 setup.py build" maybe works if setuptools does
--HG-- branch : trunk
This commit is contained in:
parent
c8119d89b6
commit
3c3002ccd5
|
@ -32,8 +32,8 @@ on tests that wait on reading something from stdin.
|
|||
You can influence output capturing mechanisms from the command line::
|
||||
|
||||
py.test -s # disable all capturing
|
||||
py.test --capture=sys # set StringIO() to each of sys.stdout/stderr
|
||||
py.test --capture=fd # capture stdout/stderr on Filedescriptors 1/2
|
||||
py.test --capture=sys # replace sys.stdout/stderr with in-mem files
|
||||
py.test --capture=fd # point filedescriptors 1 and 2 to temp file
|
||||
|
||||
If you set capturing values in a conftest file like this::
|
||||
|
||||
|
@ -46,7 +46,9 @@ sys-level capturing
|
|||
------------------------------------------
|
||||
|
||||
Capturing on 'sys' level means that ``sys.stdout`` and ``sys.stderr``
|
||||
will be replaced with StringIO() objects.
|
||||
will be replaced with in-memory files (``py.io.TextIO`` to be precise)
|
||||
that capture writes and decode non-unicode strings to a unicode object
|
||||
(using a default, usually, UTF-8, encoding).
|
||||
|
||||
FD-level capturing and subprocesses
|
||||
------------------------------------------
|
||||
|
@ -71,8 +73,9 @@ per-test capturing. Here is an example test function:
|
|||
.. sourcecode:: python
|
||||
|
||||
def test_myoutput(capsys):
|
||||
print "hello"
|
||||
print >>sys.stderr, "world"
|
||||
print ("hello")
|
||||
sys.stderr.write("world
|
||||
")
|
||||
out, err = capsys.readouterr()
|
||||
assert out == "hello\n"
|
||||
assert err == "world\n"
|
||||
|
|
|
@ -1,38 +1,38 @@
|
|||
.. _`helpconfig`: helpconfig.html
|
||||
.. _`terminal`: terminal.html
|
||||
.. _`pytest_recwarn.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.0.2/py/test/plugin/pytest_recwarn.py
|
||||
.. _`pytest_recwarn.py`: http://bitbucket.org/hpk42/py-trunk/raw/trunk/py/test/plugin/pytest_recwarn.py
|
||||
.. _`unittest`: unittest.html
|
||||
.. _`pytest_monkeypatch.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.0.2/py/test/plugin/pytest_monkeypatch.py
|
||||
.. _`pytest_keyword.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.0.2/py/test/plugin/pytest_keyword.py
|
||||
.. _`pytest_monkeypatch.py`: http://bitbucket.org/hpk42/py-trunk/raw/trunk/py/test/plugin/pytest_monkeypatch.py
|
||||
.. _`pytest_keyword.py`: http://bitbucket.org/hpk42/py-trunk/raw/trunk/py/test/plugin/pytest_keyword.py
|
||||
.. _`pastebin`: pastebin.html
|
||||
.. _`plugins`: index.html
|
||||
.. _`pytest_capture.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.0.2/py/test/plugin/pytest_capture.py
|
||||
.. _`pytest_doctest.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.0.2/py/test/plugin/pytest_doctest.py
|
||||
.. _`pytest_capture.py`: http://bitbucket.org/hpk42/py-trunk/raw/trunk/py/test/plugin/pytest_capture.py
|
||||
.. _`pytest_doctest.py`: http://bitbucket.org/hpk42/py-trunk/raw/trunk/py/test/plugin/pytest_doctest.py
|
||||
.. _`capture`: capture.html
|
||||
.. _`pytest_nose.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.0.2/py/test/plugin/pytest_nose.py
|
||||
.. _`pytest_restdoc.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.0.2/py/test/plugin/pytest_restdoc.py
|
||||
.. _`pytest_nose.py`: http://bitbucket.org/hpk42/py-trunk/raw/trunk/py/test/plugin/pytest_nose.py
|
||||
.. _`pytest_restdoc.py`: http://bitbucket.org/hpk42/py-trunk/raw/trunk/py/test/plugin/pytest_restdoc.py
|
||||
.. _`xfail`: xfail.html
|
||||
.. _`pytest_pastebin.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.0.2/py/test/plugin/pytest_pastebin.py
|
||||
.. _`pytest_figleaf.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.0.2/py/test/plugin/pytest_figleaf.py
|
||||
.. _`pytest_hooklog.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.0.2/py/test/plugin/pytest_hooklog.py
|
||||
.. _`pytest_pastebin.py`: http://bitbucket.org/hpk42/py-trunk/raw/trunk/py/test/plugin/pytest_pastebin.py
|
||||
.. _`pytest_figleaf.py`: http://bitbucket.org/hpk42/py-trunk/raw/trunk/py/test/plugin/pytest_figleaf.py
|
||||
.. _`pytest_hooklog.py`: http://bitbucket.org/hpk42/py-trunk/raw/trunk/py/test/plugin/pytest_hooklog.py
|
||||
.. _`checkout the py.test development version`: ../../download.html#checkout
|
||||
.. _`pytest_helpconfig.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.0.2/py/test/plugin/pytest_helpconfig.py
|
||||
.. _`pytest_helpconfig.py`: http://bitbucket.org/hpk42/py-trunk/raw/trunk/py/test/plugin/pytest_helpconfig.py
|
||||
.. _`oejskit`: oejskit.html
|
||||
.. _`doctest`: doctest.html
|
||||
.. _`get in contact`: ../../contact.html
|
||||
.. _`pytest_xfail.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.0.2/py/test/plugin/pytest_xfail.py
|
||||
.. _`pytest_xfail.py`: http://bitbucket.org/hpk42/py-trunk/raw/trunk/py/test/plugin/pytest_xfail.py
|
||||
.. _`figleaf`: figleaf.html
|
||||
.. _`customize`: ../customize.html
|
||||
.. _`hooklog`: hooklog.html
|
||||
.. _`pytest_terminal.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.0.2/py/test/plugin/pytest_terminal.py
|
||||
.. _`pytest_terminal.py`: http://bitbucket.org/hpk42/py-trunk/raw/trunk/py/test/plugin/pytest_terminal.py
|
||||
.. _`recwarn`: recwarn.html
|
||||
.. _`pytest_pdb.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.0.2/py/test/plugin/pytest_pdb.py
|
||||
.. _`pytest_pdb.py`: http://bitbucket.org/hpk42/py-trunk/raw/trunk/py/test/plugin/pytest_pdb.py
|
||||
.. _`monkeypatch`: monkeypatch.html
|
||||
.. _`resultlog`: resultlog.html
|
||||
.. _`keyword`: keyword.html
|
||||
.. _`restdoc`: restdoc.html
|
||||
.. _`django`: django.html
|
||||
.. _`pytest_unittest.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.0.2/py/test/plugin/pytest_unittest.py
|
||||
.. _`pytest_unittest.py`: http://bitbucket.org/hpk42/py-trunk/raw/trunk/py/test/plugin/pytest_unittest.py
|
||||
.. _`nose`: nose.html
|
||||
.. _`pytest_resultlog.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.0.2/py/test/plugin/pytest_resultlog.py
|
||||
.. _`pytest_resultlog.py`: http://bitbucket.org/hpk42/py-trunk/raw/trunk/py/test/plugin/pytest_resultlog.py
|
||||
.. _`pdb`: pdb.html
|
||||
|
|
|
@ -10,8 +10,8 @@ safely patch object attributes, dicts and environment variables.
|
|||
Usage
|
||||
----------------
|
||||
|
||||
Use the `monkeypatch funcarg`_ to safely patch environment
|
||||
variables, object attributes or dictionaries. For example, if you want
|
||||
Use the `monkeypatch funcarg`_ to safely modify or delete environment
|
||||
variables, object attributes or dictionary values. For example, if you want
|
||||
to set the environment variable ``ENV1`` and patch the
|
||||
``os.path.abspath`` function to return a particular value during a test
|
||||
function execution you can write it down like this:
|
||||
|
@ -37,6 +37,20 @@ can use this example:
|
|||
monkeypatch.setenv('PATH', 'x/y', prepend=":")
|
||||
# x/y will be at the beginning of $PATH
|
||||
|
||||
calling "undo" finalization explicitely
|
||||
-----------------------------------------
|
||||
|
||||
Usually at the end of function execution py.test will invoke
|
||||
a teardown hook which undoes the changes. If you cannot wait
|
||||
that long you can also call finalization explicitely::
|
||||
|
||||
monkeypatch.undo()
|
||||
|
||||
This will undo previous changes. This call consumes the
|
||||
undo stack. Calling it a second time has no effect.
|
||||
Within a test you can continue to use the monkeypatch
|
||||
object, however.
|
||||
|
||||
.. _`monkeypatch blog post`: http://tetamap.wordpress.com/2009/03/03/monkeypatching-in-unit-tests-done-right/
|
||||
|
||||
.. _`monkeypatch funcarg`:
|
||||
|
@ -45,15 +59,22 @@ can use this example:
|
|||
the 'monkeypatch' test function argument
|
||||
----------------------------------------
|
||||
|
||||
The returned ``monkeypatch`` funcarg provides three
|
||||
The returned ``monkeypatch`` funcarg provides these
|
||||
helper methods to modify objects, dictionaries or os.environ::
|
||||
|
||||
monkeypatch.setattr(obj, name, value)
|
||||
monkeypatch.delattr(obj, name, raising=True)
|
||||
monkeypatch.setitem(mapping, name, value)
|
||||
monkeypatch.setenv(name, value)
|
||||
monkeypatch.delitem(obj, name, raising=True)
|
||||
monkeypatch.setenv(name, value, prepend=False)
|
||||
monkeypatch.delenv(name, value, raising=True)
|
||||
monkeypatch.syspath_prepend(path)
|
||||
|
||||
All such modifications will be undone when the requesting
|
||||
test function finished its execution.
|
||||
All modifications will be undone when the requesting
|
||||
test function finished its execution. For the ``del``
|
||||
methods the ``raising`` parameter determines if a
|
||||
KeyError or AttributeError will be raised if the
|
||||
deletion has no target.
|
||||
|
||||
Start improving this plugin in 30 seconds
|
||||
=========================================
|
||||
|
|
42
setup.py
42
setup.py
|
@ -23,6 +23,7 @@ For questions please check out http://pylib.org/contact.html
|
|||
.. _`py.path`: http://pylib.org/path.html
|
||||
.. _`py.code`: http://pylib.org/code.html
|
||||
|
||||
(c) Holger Krekel and others, 2009
|
||||
|
||||
"""
|
||||
trunk = 'trunk'
|
||||
|
@ -58,44 +59,25 @@ def main():
|
|||
'Topic :: Utilities',
|
||||
'Programming Language :: Python'],
|
||||
packages=['py',
|
||||
'py._testing',
|
||||
'py.builtin',
|
||||
'py.builtin.testing',
|
||||
'py.cmdline',
|
||||
'py.cmdline.testing',
|
||||
'py.code',
|
||||
'py.code.testing',
|
||||
'py.compat',
|
||||
'py.compat.testing',
|
||||
'py.execnet',
|
||||
'py.execnet.script',
|
||||
'py.execnet.testing',
|
||||
'py.io',
|
||||
'py.io.testing',
|
||||
'py.log',
|
||||
'py.log.testing',
|
||||
'py.path',
|
||||
'py.path.gateway',
|
||||
'py.path.testing',
|
||||
'py.process',
|
||||
'py.process.testing',
|
||||
'py.rest',
|
||||
'py.rest.testing',
|
||||
'py.test',
|
||||
'py.test.dist',
|
||||
'py.test.dist.testing',
|
||||
'py.test.looponfail',
|
||||
'py.test.looponfail.testing',
|
||||
'py.test.plugin',
|
||||
'py.test.testing',
|
||||
'py.test.testing.import_test.package',
|
||||
'py.test.web',
|
||||
'py.thread',
|
||||
'py.thread.testing',
|
||||
'py.xmlobj',
|
||||
'py.xmlobj.testing'],
|
||||
package_data={'py': ['LICENSE',
|
||||
'bin/_findpy.py',
|
||||
'py.thread'],
|
||||
package_data={'py': ['bin/_findpy.py',
|
||||
'bin/env.cmd',
|
||||
'bin/env.py',
|
||||
'bin/py.cleanup',
|
||||
|
@ -114,23 +96,7 @@ def main():
|
|||
'bin/win32/py.svnwcrevert.cmd',
|
||||
'bin/win32/py.test.cmd',
|
||||
'bin/win32/py.which.cmd',
|
||||
'compat/LICENSE',
|
||||
'compat/testing/test_doctest.txt',
|
||||
'compat/testing/test_doctest2.txt',
|
||||
'execnet/NOTES',
|
||||
'execnet/improve-remote-tracebacks.txt',
|
||||
'path/gateway/TODO.txt',
|
||||
'path/notes-svn-quoting.txt',
|
||||
'path/testing/repotest.dump',
|
||||
'rest/rest.sty.template',
|
||||
'rest/testing/data/example.rst2pdfconfig',
|
||||
'rest/testing/data/example1.dot',
|
||||
'rest/testing/data/formula.txt',
|
||||
'rest/testing/data/formula1.txt',
|
||||
'rest/testing/data/graphviz.txt',
|
||||
'rest/testing/data/part1.txt',
|
||||
'rest/testing/data/part2.txt',
|
||||
'rest/testing/data/tocdepth.rst2pdfconfig']},
|
||||
'rest/rest.sty.template']},
|
||||
zip_safe=False,
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in New Issue