Commit Graph

3461 Commits

Author SHA1 Message Date
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 95cc114b34 add changelog entry:
fix issue412: messing with stdout/stderr FD-level streams is now
captured without crashes.
2014-03-28 11:29:29 +01: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 b5467645d3 merge 2014-03-28 09:27:44 +01:00
holger krekel a65380941d Merged in msabramo/pytest/sys_meta_path_remove_hook_only_if_present (pull request #133)
Only try to remove hook from sys.meta_path if it's present
2014-03-28 09:10:58 +01:00
Marc Abramowitz 17d7c60735 test_sys_meta_path_munged: Simplify with makepyfile
--HG--
branch : sys_meta_path_remove_hook_only_if_present
2014-03-28 01:03:52 -07:00
Marc Abramowitz 81f822d528 Only try to remove hook from sys.meta_path if it's present
Prevent error on exit if some code messes with sys.meta_path and removes the
assertionrewrite hook (CaptureMock seems to do this):

      File "/Users/marca/dev/hg-repos/pytest/_pytest/assertion/__init__.py", line 64, in pytest_unconfigure
        sys.meta_path.remove(hook)
    ValueError: list.remove(x): x not in list

--HG--
branch : sys_meta_path_remove_hook_only_if_present
2014-03-28 00:33:12 -07:00
holger krekel 0b340aa1f6 simplify some capturing tests 2014-03-28 07:55:07 +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
Ronny Pfannschmidt 2b2c1e5b7b condition for python3 of the xfailing test for 412 2014-03-27 14:01:38 +01:00
holger krekel 7b63fa5966 merge in current default 2014-03-27 13:57:54 +01:00
Ronny Pfannschmidt b18040337a xfailing test for issue 412 2014-03-27 13:53:59 +01:00
holger krekel 42e0d7970c Merged in nloadholtes/pytest/nloadholtes/slight-change-to-the-wording-for-readabi-1395890493571 (pull request #131)
Slight change to the wording for readability
2014-03-27 06:40:35 +01:00
Nick Loadholtes ed0a4fe23b Slight change to the wording for readability
--HG--
branch : nloadholtes/slight-change-to-the-wording-for-readabi-1395890493571
2014-03-27 03:21:58 +00:00
holger krekel bb0632c7ad extend test 2014-03-26 19:37:49 +01:00
holger krekel 84ab194516 add changelog: merge PR123: improved integration with mock.patch decorator on tests. 2014-03-26 19:06:56 +01:00
holger krekel 530cae9204 Merged in cgilling/pytest (pull request #123)
Fix to work properly when @patch is used with new not equal to DEFAULT
2014-03-26 19:05:46 +01:00
holger krekel 9dc43e84dc Merged in msabramo/pytest/help_show_args_with_equals_instead_of_space (pull request #130)
_pytest/config.py: In --help, show args with `=` instead of space.
2014-03-26 19:04:35 +01:00
Marc Abramowitz 8af265da04 _pytest/config.py: In --help, show args with `=` instead of space.
The `=` is better because it encourages folks to use the form that doesn't
suffer from issue #436 (https://bitbucket.org/hpk42/pytest/issue/436), which
can cause the arg to be treated as an "anchor" and used as the (unexpected)
path for searching for conftest.py files.

--HG--
branch : help_show_args_with_equals_instead_of_space
2014-03-26 10:47:30 -07:00
Chris Gilling e3b9382122 use sys.modules.get correctly and reference DEFAULT with respect to it 2014-03-26 09:36:02 -07:00
Chris Gilling c3f4eb6d57 change try/except to sys.module.get and a conditional 2014-03-26 09:27:33 -07:00
holger krekel 892aa457be fix issue472: clarify that ``pytest.config.getvalue()`` cannot work
if it's triggered ahead of command line parsing.
2014-03-26 07:15:54 +01:00
holger krekel 8f7b53e55b fix issue490: include pytest_load_initial_conftests in documentation
and improve docstring.
2014-03-25 14:43:58 +01:00
holger krekel d27c377817 tentatively fix py33 and py25 compat 2014-03-14 15:58:16 +01:00
holger krekel 50abe43216 fix issue #479: properly handle nose/unittest(2) SkipTest exceptions
during collection/loading of test modules.  Thanks to Marc Schlaich
for the complete PR.
2014-03-14 15:44:39 +01:00
holger krekel ddc67ca13a Merged in schlamar/pytest (pull request #129)
Fixed race condition with SkipTest when module not in sys.modules on collection.
2014-03-14 15:39:01 +01:00
holger krekel a1d3da4027 Merged in nicoddemus/pytest/integrate-plugin-index-docs (pull request #120)
Integrating plugin_index docs and misc improvements
2014-03-14 15:34:03 +01:00
schlamar 85e7b11ef5 Removed unnecessary iteration in nose.pytest_runtest_makereport. 2014-03-14 15:29:42 +01:00
schlamar 77e1f93ca1 Fixed pyflakes errors. 2014-03-14 14:25:36 +01:00
schlamar 94b1ce65c6 Fixed race condition with SkipTest when module not in sys.modules on collection. 2014-03-14 14:04:54 +01:00
holger krekel f5b992f68a Merged in jurko/pytest/doc_typo_correction (pull request #122)
fix documentation typo
2014-03-14 13:10:33 +01:00
holger krekel 24a458b4c8 Merged in graingert/pytest/graingert/pep8-good-practices-code-1394196858258 (pull request #125)
pep8 good practices code
2014-03-14 13:06:53 +01:00
holger krekel ac1d277225 simplify pdb disabling of capturing, also accomodate the new semantics
that capturing is always on during a test session.
2014-03-14 12:49:37 +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 f43cda9681 implement a new hook type: hook wrappers using a "yield" to distinguish
between working at the front and at the end of a hook call chain.
The idea is to make it easier for a plugin to "wrap" a certain hook
call and use context managers, in particular allow a major cleanup of
capturing.
2014-03-14 12:49:35 +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 cfd43a9b02 add changelog for warning system, bump internal version 2014-03-14 08:15:38 +01:00
holger krekel ebd10aa6b4 shrink and merge the somewhat obscure and undocumented internal hinting
system with the new warnings one
2014-03-11 22:10:51 +01:00
holger krekel 24db492f53 warn if instances are callable and have a test name 2014-03-11 22:10:18 +01:00
holger krekel 1b387bea62 introduce warning system with this API:
- node.warn() for a node-specific warning
- config.warn() for a global non-node specific warning

Each warning is accompanied by a "warning number" so that we can later
introduce mechanisms for surpressing them.

Each warning will trigger a call to pytest_report_warn(number, node, message)
which is by default implemented by the TerminalReporter which introduces
a new option "-rw" to show details about warnings.
2014-03-11 22:10:17 +01:00
Thomas Grainger 9528b64f7f pep8 good practices code
--HG--
branch : graingert/pep8-good-practices-code-1394196858258
2014-03-07 12:51:51 +00:00
holger krekel b96559149c Merged in jurko/pytest/pdb_doc_update (pull request #118)
update PDB related pytest docs
2014-03-06 08:36:42 +01:00