Commit Graph

42 Commits

Author SHA1 Message Date
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
Anthon van der Neut 15ec5a898c moving from optparse to argparse. Major difficulty is
that argparse does not have Option objects -> added class Argument
Needed explicit call of MyOptionParser.format_epilog as argparse
does not have that. The parse_arg epilog argument wraps the text,
which is not the same (could be handled with a special formatter).

- parser.parse() now returns single argument (with positional args in
  .file_or_dir)
- "file_or_dir" made a class variable Config._file_or_dir and used in help and tests
- added code for argcomplete (because of which this all started!)

addoption:
- if option type is a string ('int' or 'string', this converted to
  int resp. str
- if option type is 'count' this is changed to the type of choices[0]

testing:
- added tests for Argument
- test_mark.test_keyword_extra split as ['-k', '-mykeyword'] generates argparse
  error test split in two and one marked as fail
- testing hints, multiline and more strickt (for if someone moves format_epilog
  to epilog argument of parse_args without Formatter)
- test for destination derived from long option with internal dash
- renamed second test_parseopt.test_parse() to test_parse2 as it was
  not tested at all (the first was tested.)

--HG--
branch : argparse
2013-07-25 15:33:43 +02:00
Adam Goucher 1cbd2db621 stdout/stderr now captured by junitxml 2013-04-16 00:45:14 -04:00
holger krekel 68786a6434 fix bug where using capsys with pytest.set_trace() in a test
function would break when looking at capsys.readouterr()
2012-11-21 20:43:31 +01:00
holger krekel bb07ba7807 rename a number of internal and externally visible variables to use the fixture name
rather than funcargs.  Introduce .funcargnames compatibility attribute for backward compat.
2012-10-05 14:24:44 +02:00
holger krekel 4e4b507472 move funcarg factory to a new FuncargManager object at session level 2012-07-19 09:20:14 +02:00
holger krekel c7ee6e71ab re-introduce the old 2.2.4 FuncargRequest implementation as it is a better
base for implementing the new funcarg/setup api. Also Un-optimize
funcargnames discovery for now.
2012-07-18 19:49:14 +02:00
holger krekel 8adac2878f put automatic funcarg_ API to Py*objects only, refine internal subclassing and initialisation logic 2012-07-16 10:46:44 +02:00
holger krekel 91b6f2bda8 mid-scale refactoring to make request API available directly on items.
This commit was slightly tricky because i want to backward
compatibility especially for the oejskit plugin which
uses Funcarg-filling for non-Function objects.
2012-06-25 17:35:33 +02:00
holger krekel 4d77653bb0 simplify activate_funcargs 2012-06-03 21:06:43 +02:00
holger krekel 3f17784386 fix issue128 - show captured output when capsys/capfd are in use 2012-06-03 21:01:27 +02:00
holger krekel a5e7b2760d fix issue90 - perform teardown after its actual test function/item. This is implemented by modifying the runtestprotocol to remember "pending" teardowns and call them before the setup of the next item. 2011-11-18 16:01:29 +00:00
holger krekel a2f4a11301 refine lsof/FD leakage testing and rework test setup and some of pytest own tests. Note that the actual diff to non-test code is small. Also remove some redundant tests (introduced by a copy-paste-error apparently in test_mark.py). 2011-11-07 18:08:41 +00:00
holger krekel f3bc197afb fix #59: provide better Jenkins stdout and stderr sections 2011-07-12 23:09:03 +02:00
holger krekel fadd1a2313 incorporate typo/grammar fixes from Laura and respond to a number of issues she raised in comments.
Also fixed links and some other bits and pieces.
2011-03-03 23:40:38 +01:00
holger krekel d8d88ede65 refine and unify initial capturing - now works also if the logging module
is already used from an early-loaded conftest.py file (prior to option parsing)
2011-01-18 12:51:21 +01:00
holger krekel 2e80512bb8 fix issue8 : avoid errors caused by logging module wanting to close already closed streams.
The issue arose if logging was initialized while capturing was enabled
and then capturing streams were closed before process exit, leading
to the logging module to complain.
2010-12-06 16:56:12 +01:00
holger krekel bc42cf8ffb add a way to mark hooks as "tryfirst" or "trylast" to influence its position in a hook chain.
Use 'tryfirst' for capturing hooks so they can start capturing as early as possible,
including when conftests add output in runtest_setup hooks.
2010-11-21 23:17:59 +01:00
holger krekel 929291775e flat is better than nested (cont'd):
- pytest.py is new module, making "python -m pytest" work always
- _pytest/*.py now contains core.py, hookspec and the plugins, no sub packages
2010-11-13 11:10:45 +01:00