Florian Bruhin
c10f483b9f
Don't hardcode 'std' for captured stdout/stderr.
...
This will make Item.add_report_sect more usable for plugins.
See https://github.com/eisensheng/pytest-catchlog/pull/7
2015-09-22 20:29:16 +02:00
David Szotten
983d249680
reset capture even if readouterr throws
...
otherwise that exception (and all following output) end up in /dev/null
2015-07-26 01:15:51 +02:00
holger krekel
bddc88f09e
adapt to pluggy naming, rename pytest.hookspec_opts to pytest.hookspec,s ame with hookimpl_opts
...
--HG--
branch : pluggy1
2015-05-06 10:08:08 +02:00
holger krekel
d2a5c7f99b
add documented hookimpl_opts and hookspec_opts decorators
...
so that one doesn't have to use pytest.mark or function-attribute setting anymore
--HG--
branch : more_plugin
2015-04-25 11:29:11 +02:00
holger krekel
715a235b45
remove shutdown logic from PluginManager and add a add_cleanup() API
...
for the already existing cleanup logic of the config object.
This simplifies lifecycle management as we don't keep two
layers of shutdown functions and also simplifies the pluginmanager
interface.
also add some docstrings.
--HG--
branch : plugin_no_pytest
2015-04-22 16:33:20 +02:00
holger krekel
0253f7b8d5
remove all occurences of "__multicall__" on hook impls in pytest/*.
...
also simplify pytest_runtest_markereport hook in _pytest/skipping.py
while touching the code anyway.
2014-10-08 20:23:40 +02:00
David Szotten
bc4eecbbac
add `encoding` attr to DontReadFromInput
...
required by https://docs.python.org/2/library/stdtypes.html#file.encoding
and used e.g. by ipdb at _import_ time
--HG--
branch : dontreadfrominput-encoding
2014-09-22 12:19:27 +01:00
Floris Bruynooghe
7d9d502a01
Use py3k compatible .__getattr__() code
...
From the python-dev thread it seemed like using
object.__getattribute__(self, 'name') is the cleanest way of
implementing a class wich uses .__getattr__() and should be
pickelable. That only works on new-style classes so this also turns
HookProxy into a new-style class on py2.
This also re-writes the test to not use cPickle so it runs on py3k.
2014-09-05 23:55:14 +01:00
uweschmitt
224b3a2eda
hopefully final fix for strange infinite recursion bug
2014-08-11 12:57:47 +02:00
uweschmitt
5d024c7433
hopefully final fix for strange infinite recursion bug
2014-08-11 12:42:36 +02:00
uweschmitt
c0d1f3f7ef
even better fix as replacement for last commit which was wrong
2014-08-07 17:17:05 +02:00
uweschmitt
9597d3dafe
better fix as replacement for last commit
2014-08-07 16:56:45 +02:00
uweschmitt
f7282b84bd
fixed strange infinite recursion bug
2014-08-07 16:13:12 +02:00
holger krekel
1d7b574b31
fix issue555: just add "errors" attribute to internal Capture stream.
2014-08-07 11:05:42 +02:00
holger krekel
1265612465
fix issue547 2.6 regression: capsys/capfd now work again when output capturing ("-s") is disabled.
2014-07-28 13:17:37 +02:00
Jurko Gospodnetić
c9bbdf4f10
correct a capfd fixture docstring typo
...
--HG--
branch : fix_capfd_fixture_docstring
2014-04-03 09:59:04 +02:00
holger krekel
3bca62e9e4
fix issue436: improved finding of initial conftest files from command
...
line arguments by using the result of parse_known_args rather than
the previous flaky heuristics. Thanks Marc Abramowitz for tests
and initial fixing approaches in this area.
2014-04-02 11:29:23 +02:00
holger krekel
3b8935c533
remove dupped_stdout logic and related changes, also simplify pytest_runtest_* calls to not use a contextlib with-decorator anymore.
2014-04-01 15:03:17 +02:00
holger krekel
ce8678e6d5
remove non-documented per-conftest capturing option and simplify/refactor all code accordingly. Also make capturing more robust against tests closing FD1/2 and against pdb.set_trace() calls.
2014-04-01 14:32:12 +02:00
holger krekel
2e1f6c85f6
introduce resume/suspend functionality for FDCapture and SysCapture,
...
fixing problems with early bailouts (from argparse's parse() function e.g.)
that wrote to stdout.
2014-04-01 14:19:58 +02:00
holger krekel
ca5e6830c6
avoid some redundancy by using SysCapture from FDCapture for manipulating sys.std{out,in,err}
2014-04-01 14:19:55 +02:00
holger krekel
69cbac8fb5
rename StdCaptureBase to MultiCapture
2014-04-01 14:19:52 +02:00
holger krekel
9d716a39d6
fix issue412 and other encoding issues. Streamline dupfile() into
...
a new more thoughtful safe_text_dupfile helper.
2014-03-28 11:27:02 +01:00
holger krekel
923dcfd620
cleanup and refine issue412 test (still failing on py33)
2014-03-28 09:46:38 +01:00
holger krekel
859915dc5e
simplify capturing funcarg handling
2014-03-28 07:13:08 +01:00
holger krekel
a8f4f49a82
simplify reset/stop_capturing and fix capturing wrt to capturing simple os.write() calls
2014-03-28 07:11:25 +01:00
holger krekel
e18c3ed494
unify and normalize Sys/FD Capturing classes
...
* * *
more unification
2014-03-28 07:03:37 +01:00
holger krekel
2263fcf6b7
remove unused "suspend/resume" on capturing, some formatting cleanup
2014-03-28 07:03:34 +01:00
holger krekel
d27c377817
tentatively fix py33 and py25 compat
2014-03-14 15:58:16 +01:00
holger krekel
9777703e03
- turn on capturing before early conftest loading and make terminal writer
...
use the original stream.
- avoid resetting capture FDs/sys.stdout for each test by keeping capturing
always turned on and looking at snapshotted capturing data during runtest
and collection phases.
2014-03-14 12:49:36 +01:00
holger krekel
b47fdbe0a7
remove externally setting and dealing with "item.outerr" from capturing in favor of a direct interface for adding reporting sections to items.
...
* * *
refactor makereport implementation to avoid recursion with __multicall__
2014-03-14 12:49:34 +01:00
holger krekel
cde970be69
remove unneccessary indirections and options
2014-03-14 12:49:34 +01:00
holger krekel
6f385fb4ea
remove "mixed" capturing mode which is not used by pytest
...
--HG--
branch : capsimple1
2014-01-25 19:56:27 +01:00
holger krekel
18e12cbd67
remove "StdCapture*.call" classmethod because pytest does not use it.
...
--HG--
branch : capsimple1
2014-01-25 19:43:57 +01:00
holger krekel
3cf4e133cc
remove now parameter because pytest only used now==False everywhere
...
--HG--
branch : capsimple1
2014-01-25 19:42:45 +01:00
Ronny Pfannschmidt
177637bfb9
Redo the Capture integration propperly
2014-01-24 21:22:19 +01:00
holger krekel
9aaf0fd340
backing out Ronny's PR because it was merged too early (still has failing tests)
2014-01-22 22:15:40 +01:00
Ronny Pfannschmidt
8976b3ee0e
stop exposing capsys/capfd.capture
2014-01-22 21:52:32 +01:00
Ronny Pfannschmidt
ac2f2b1deb
add notes on the copied pylib version
2014-01-22 21:50:07 +01:00
Ronny Pfannschmidt
b4a397d153
kill ancient capture devnullpath, os.devnull exists since py 2.4
2014-01-22 21:37:59 +01:00
Ronny Pfannschmidt
d1a9ab3df0
small cleanp
2014-01-22 21:04:00 +01:00
Ronny Pfannschmidt
0ede968ec0
kill the str magic of Encodedfile
2014-01-22 21:03:49 +01:00
Ronny Pfannschmidt
5f21abc3a3
move imports and declarations to the top
2014-01-22 20:48:17 +01:00
Ronny Pfannschmidt
e2bb81124c
simplify StdCaptureFD snapshot reading
2014-01-22 19:48:10 +01:00
Ronny Pfannschmidt
ea18e9656b
rewrite all _pytest.capture uses of py.io to _pytest.capture
2014-01-22 19:44:20 +01:00
Ronny Pfannschmidt
0ac94134f5
initial code import for capture transfer
2014-01-22 19:04:38 +01:00
holger krekel
071960250f
avoid "IOError: Bad Filedescriptor" on pytest shutdown by not closing
...
the internal dupped stdout (fix is slightly hand-wavy but work).
2013-10-02 12:39:01 +02:00
holger krekel
2c7d00579b
bump version, some windows test fixes, prevent logging from raising exceptions at the end (finally), add py25 to tox.ini.
2013-09-30 16:09:26 +02:00
holger krekel
db6f347db6
fix issue358 -- introduce new pytest_load_initial_conftests hook and make capturing initialization use it, relying on a new (somewhat internal) parser.parse_known_args() method.
...
This also addresses issue359 -- plugins like pytest-django could implement a pytest_load_initial_conftests hook like the capture plugin.
2013-09-30 13:14:16 +02:00
holger krekel
a930f44e60
introduce pluginmanager.ensure_teardown() which allows
2013-09-28 22:23:00 +02:00