Commit Graph

2500 Commits

Author SHA1 Message Date
Bruno Oliveira 3a9d0b26d5 Use pytest_runtest_logstart to signal the start of a new test
This also simplifies the code a bit because we don't need to keep
a set of ids anymore
2018-01-22 21:20:48 -02:00
Raphael Castaneda a5e60b6a2d implement #3130 - adding record_xml_attribute fixture
update incorrect expected attribute value in test_record_attribute

attr names must be strings

Update CHANGELOG formatting

update usage documentation

Fix versionadded for record_xml_attribute

Indent the xml schema properly inside the warning box in the docs
2018-01-22 15:14:53 -08:00
Bruno Oliveira 0df42b4426 Show a header for each testing phase during live logging
As suggested during review
2018-01-22 21:00:52 -02:00
Bruno Oliveira 0d96a5bf90
Merge pull request #3135 from brianmaissy/doc/clarify_pytest_fixture_setup_with_fixture_that_returns_None
Clarify a possible confusion when using pytest_fixture_setup with fixture functions that return None
2018-01-22 18:02:33 -02:00
Brian Maissy 8994603d46 Document hooks (defined with historic=True) which cannot be used with hookwrapper=True 2018-01-21 23:17:16 +02:00
Brian Maissy 196dcc37a8 Clarify a possible confusion when using pytest_fixture_setup with fixture functions that return None 2018-01-21 21:50:26 +02:00
feuillemorte 83034bbd48 #1642 Fix rootdir option 2018-01-20 22:30:01 +03:00
Bruno Oliveira 29a7b5e064 Initialize log_cli_handler to None during LoggingPlugin init
Some of testdir's functionality bypasses pytest_runtestloop so this
attribute needs to be set early
2018-01-20 14:19:45 -02:00
Bruno Oliveira 9dbcac9af3 Suspend stdout/stderr capturing when emitting live logging messages 2018-01-20 12:02:55 -02:00
Bruno Oliveira 97a4967b03 Improve code formatting 2018-01-20 12:02:55 -02:00
Bruno Oliveira 8f6a5928f7 Add newline before log messages and enable -v output when log_cli is enabled 2018-01-20 12:02:55 -02:00
Bruno Oliveira 5d89a93977 Small improvements to tests suggested during review 2018-01-20 12:02:54 -02:00
Bruno Oliveira 8d735f3e1d Live log option now writes to the terminal reporter
Ref: #3013
2018-01-20 12:01:42 -02:00
Bruno Oliveira aca1b06747 Undo log level set by caplog.set_level at the end of the test
Otherwise this leaks the log level information to other tests

Ref: #3013
2018-01-20 12:01:42 -02:00
Bruno Oliveira 8dcd2718aa No longer change the level of any logger unless requested explicitly
Ref: #3013
2018-01-20 12:01:42 -02:00
Bruno Oliveira 5ad1313b8a log_cli must now be enabled explicitly
Ref: #3013
2018-01-20 12:00:46 -02:00
Bruno Oliveira 3b3d237f07
Merge pull request #3117 from boxed/access_logs_in_teardown
Access captures logs in teardown
2018-01-20 11:21:17 -02:00
Anders Hovmöller 7ea5a22657 Access captures logs in teardown 2018-01-19 12:42:35 +01:00
feuillemorte d784155fd2 #1642 Add rootdir option 2018-01-17 23:02:31 +03:00
Bruno Oliveira e3406e0818 Show usage errors in red 2018-01-16 19:35:32 -02:00
feuillemorte 8433e2ba04 #2953 fix comments: fix exception type 2018-01-16 23:35:57 +03:00
feuillemorte 648d5d0c6b #2953 fix comments: use keyword module 2018-01-16 22:55:24 +03:00
feuillemorte 076fb56f85 show a simple and easy error when keyword expressions trigger a syntax error 2018-01-16 21:30:44 +03:00
Bruno Oliveira abbdb60051 Move logic determining if progress should be displayed to a function 2018-01-12 07:04:43 -02:00
Bruno Oliveira 5939b336cd Fix progress report when tests fail during teardown
Fix #3088
2018-01-11 20:42:05 -02:00
Aaron 4a704bbb55 fix reorder_items_atscope ordering 2018-01-11 11:30:52 -08:00
Aaron ee6c9f50a2 optimize fixtures.reorder_items 2018-01-11 11:30:52 -08:00
Bruno Oliveira 2674f352e8
Merge pull request #3091 from nicoddemus/conftest-hooks
Document bootstrap and initialization hooks
2018-01-11 11:14:20 -02:00
Bruno Oliveira b68b80aec9 Add new pytest_runtest_logfinish hook
Fix #3101
2018-01-09 22:17:39 -02:00
Anthony Sottile bd1d17e8de Replace py.std with stdlib imports 2018-01-09 12:44:10 -08:00
Bruno Oliveira 93306f6a5e Merge remote-tracking branch 'upstream/master' into features 2018-01-09 18:41:00 -02:00
Bruno Oliveira b6b36bc167 Handle pluggy package or module for traceback filtering
Since 0.6.1 pluggy has been turned into a package
2018-01-08 21:29:15 -02:00
Bruno Oliveira afb8a4e35d Document bootstrap and initialization hooks
Fix #2616
2018-01-06 13:31:38 -02:00
Ian Lesperance f24c470403 Assume not skipped by mark if attribute missing
Fixes #3074.
2018-01-03 18:47:18 -05:00
Bruno Oliveira c70efaa0fb
Merge pull request #3047 from RonnyPfannschmidt/mark-newapi
move node base classes from main to nodes
2017-12-19 07:59:25 -02:00
Ronny Pfannschmidt ed293ec3e9 pytester: no ignore files used to obtain current user metadata in the fd leak detector 2017-12-18 17:52:55 +01:00
Ronny Pfannschmidt 94608c6110 port _Compatproperty to attrs 2017-12-18 11:08:20 +01:00
Ronny Pfannschmidt afc607cfd8 move node base classes from main to nodes 2017-12-18 11:08:20 +01:00
Thomas Hisch dfc5399cd7 Revert "WIP #3013"
This reverts commit 28a93b9eeb.
2017-12-17 21:50:17 +01:00
Thomas Hisch 76489d30f7 Revert "WIP"
This reverts commit d6f75d2836.
2017-12-17 21:49:57 +01:00
Thomas Hisch d6f75d2836 WIP 2017-12-17 20:11:24 +01:00
Jurko Gospodnetić f3c9c6e8a8 fix restoring Python state after in-process pytest runs
Now each in-process pytest run saves a snapshot of important global Python
state and restores it after the test completes, including the list of loaded
modules & the Python path settings.

Previously only the loaded package data was getting restored, but that was
also reverting any loaded package changes done in the test triggering the
pytest runs, and not only those done by the pytest runs themselves.

Updated acceptance tests broken by this change, which were only passing before
by accident as they were making multiple pytest runs with later ones depending
on sys.path changes left behind by the initial one.
2017-12-17 12:47:50 +01:00
Jurko Gospodnetić 67bd60d5c6 clean up Testdir taking snapshots & restoring global Python state
Now extracted to new CwdSnapshot, SysModulesSnapshot & SysPathsSnapshot
classes, each saving the state they are interested in on instantiation
and restoring it in its `restore()` method.
2017-12-17 12:47:50 +01:00
Thomas Hisch 28a93b9eeb WIP #3013 2017-12-17 06:54:57 +01:00
Bruno Oliveira d87279115d
Merge pull request #3041 from segevfiner/capture-no-disable-progress
Use classic console output when -s is used
2017-12-16 12:34:34 -02:00
Segev Finer 370daf0441 Use classic console output when -s is used
Fixes #3038
2017-12-16 15:00:23 +02:00
Bruno Oliveira db4df5833a
Merge pull request #3030 from nicoddemus/leak
Fix memory leak caused by fixture values never been garbage collected
2017-12-14 19:20:34 -02:00
Bruno Oliveira c3f63ac143 Fix memory leak caused by fixture values never been garbage collected
The leak was caused by the (unused) `FixtureRequest._fixture_values`
cache.

This was introduced because the `partial` object (created to call
FixtureDef.finish() bound with the Request) is kept alive
through the entire session when a function-scoped fixture depends
on a session-scoped (or higher) fixture because of the nested
`addfinalizer` calls.

FixtureDef.finish() started receiving a request object in order to
obtain the proper hook proxy object (#2127), but this does not seem
useful at all in practice because `pytest_fixture_post_finalizer`
will be called with the `request` object of the moment the fixture value
was *created*, not the request object active when the fixture value
is being destroyed. We should probably deprecate/remove the request
parameter from `pytest_fixture_post_finalizer`.

Fix #2981
2017-12-13 19:49:06 -02:00
Thomas Hisch 3862b0b28d Remove logger parameter from catching_logs
The logger parameter of catching_logs is not used anywhere. The main
motivation for removing the logger parameter is that it removes the

logger = logger or logging.getLogger(logger)

line. IMO there are too many occurences of the string 'logg' ;)
2017-12-13 21:13:59 +01:00
Ronny Pfannschmidt 476d4df1b7
Merge pull request #3010 from cryvate/fix-issue-2985
Improve handling of pyargs
2017-12-13 13:56:42 +01:00
Ronny Pfannschmidt 52449903c3
Merge pull request #3023 from nicoddemus/preparse-deprecated
Add param annotations and types to hookspec
2017-12-13 13:51:20 +01:00
Ronny Pfannschmidt 506c9c91c0
Merge pull request #3025 from anntzer/dont-rewrite-plugin
Respect PYTEST_DONT_REWRITE for plugins too.

closes #2995
2017-12-13 12:34:51 +01:00
Bruno Oliveira 38f34e2fa1
Merge pull request #3012 from thisch/merge_contextmanagers
Integrate logging_using_handler into catching_logs
2017-12-13 06:59:48 -02:00
Antony Lee 45e7734b1a Change set ops to use methods instead of operators. 2017-12-13 00:54:57 -08:00
Antony Lee c8e7d1ae34 Respect PYTEST_DONT_REWRITE for plugins too. 2017-12-12 17:43:17 -08:00
Bruno Oliveira 7b5d4d01ed Add param annotations and types to hookspec
Also mention which hook to use instead of the deprecated
pytest_cmdline_preparse

Fix #3022
2017-12-12 18:01:31 -02:00
Henk-Jaap Wagenaar 1e295535c3 Move _patched_find_module to module namespace. 2017-12-12 09:53:06 +00:00
Henk-Jaap Wagenaar 3ca1e4b7f0 Make patch for issue in pkgutil.ImpImporter local by using contextmanager. 2017-12-12 08:43:01 +00:00
Bruno Oliveira f8f1a52ea0 Merge remote-tracking branch 'upstream/master' into features 2017-12-11 22:18:50 -02:00
Bruno Oliveira 5c6d7739bc
Merge pull request #3015 from jurko-gospodnetic/code-cleanup
Code cleanup
2017-12-11 22:15:50 -02:00
Srinivas Reddy Thatiparthy fc544dc660 remove redundant checking because
* isinstance([], Sequence) is True

* isinstance((), Sequence) is True
2017-12-12 00:10:59 +05:30
Srinivas Reddy Thatiparthy 7792587b3f remove unnecessary import 2017-12-12 00:03:38 +05:30
Srinivas Reddy Thatiparthy cb0ba18f53 remove '_ast' module; and redirect '_ast' references to 'ast' 2017-12-11 23:14:17 +05:30
Jurko Gospodnetić 596937e610 remove extra whitespace 2017-12-09 13:34:55 +01:00
Jurko Gospodnetić 57fcd3f57e remove corpse code comments 2017-12-09 13:34:55 +01:00
Jurko Gospodnetić 65f5383106 fix comment & docstring typos, line wrapping & wording 2017-12-09 13:34:54 +01:00
Thomas Hisch ba209b5230 Integrate logging_using_handler into catching_logs
logging_using_handler is only used in catching_logs. Therefore it makes
sense to remove one of the many context managers from the logging
plugin.
2017-12-07 16:34:53 +01:00
Henk-Jaap Wagenaar b62fd79c0c Fix issue 2985. 2017-12-07 15:12:44 +00:00
Bruno Oliveira 655146e522 Merge remote-tracking branch 'upstream/master' into features 2017-12-05 22:30:35 -02:00
Florian Bruhin ce30896cd2 Also blacklist pytest-capturelog plugin
This is the older plugin before pytest-catchlog was around. Apparently there are
people still using it.

Fixes #3004
2017-12-05 20:02:56 +01:00
Ronny Pfannschmidt 2e8b0a83fe
Merge pull request #2989 from nicoddemus/bring-tr-writer-back-2984
Bring back TerminalReporter.writer as an alias to TerminalReporter._tw
2017-12-01 17:42:31 +01:00
Bruno Oliveira 369c711f14
Merge pull request #2971 from blueyed/fix-ZeroDivisionError
Fix ZeroDivisionError with 0 collected tests
2017-11-30 21:12:46 -02:00
Bruno Oliveira cf0cac3b73 Bring back TerminalReporter.writer as an alias to TerminalReporter._tw
Fix #2984
2017-11-30 19:56:47 -02:00
Bruno Oliveira 70f1e3b4b0 Improve getscopeitem assertion message
Fix #2979
2017-11-30 07:53:43 -02:00
ST John 912330a7e2 Extend _pytest.python._idval to return __name__ of functions as well, not just for classes 2017-11-29 16:17:49 +00:00
Florian Bruhin 88ed1ab648
Merge pull request #2964 from rpuntaie/master
fix issue #2920
2017-11-29 10:32:28 +01:00
Florian Bruhin 191e8c6d9b
Merge pull request #2969 from nicoddemus/null-bytes-2957
Always escape null bytes when setting PYTEST_CURRENT_TEST
2017-11-29 06:57:48 +01:00
Daniel Hahler 0f5fb7ed05 Fix ZeroDivisionError with 0 collected tests
This can easily happen with pytest-testmon.
2017-11-29 00:54:14 +01:00
Bruno Oliveira 89cf943e04 Always escape null bytes when setting PYTEST_CURRENT_TEST
Fix #2957
2017-11-28 19:45:13 -02:00
Roland Puntaier 4ea7bbc197 fix issue #2920 2017-11-28 16:47:12 +01:00
Bruno Oliveira 796db80ca4 Only escape str-like arguments passed to warnings
Fix #2956
2017-11-27 23:17:15 -02:00
Bruno Oliveira 4678cbeb91 Merge remote-tracking branch 'upstream/features' 2017-11-27 19:37:58 -02:00
Bruno Oliveira c58715371c
Merge pull request #2954 from blueyed/rewritten
Fix spelling: s/re-writ/rewrit/g
2017-11-26 18:12:30 -02:00
Daniel Hahler d5f038e29a Fix spelling: s/re-writ/rewrit/g
This also fixes "can not" to "cannot" in the "Module already imported so
cannot be rewritten" assertion error.
2017-11-26 20:46:06 +01:00
Bruno Oliveira 95de11a44e Block pytest-catchlog and issue a warning
Trying to install pytest-3.3 and pytest-catchlog will result in an
option conflicts because both declare the same options.
2017-11-23 19:53:12 -02:00
Bruno Oliveira 05cfdcc8cb Revert making TerminalWriter public in TerminalReporter plugin
We eventually want to replace py.io.TerminalWriter (exposed as
"_tw" in TerminalReporter) by something else, so deprecating access
to "_tw" and making it public as "writer" is contrary to that.
2017-11-23 19:53:12 -02:00
Bruno Oliveira f50ace7c0a Merge remote-tracking branch 'upstream/master' into release-3.3.0 2017-11-23 20:20:40 +00:00
Bruno Oliveira 1d26f3730f Fix docstrings in pytester 2017-11-22 17:15:59 -02:00
Sviatoslav Abakumov 5e71ffab87 Handle marks without description 2017-11-22 15:47:15 +03:00
Bruno Oliveira f05333ab75 Fix rewrite to not write past the edge of the screen 2017-11-22 00:00:02 -02:00
Bruno Oliveira c8d52b633b Fix assertion rewrite to match module names correctly
Fix #2939
2017-11-21 23:06:47 -02:00
Bruno Oliveira 3a5dbabf60 Add tests for progress output and docs for ``console_output_style``
Fix #2657
2017-11-21 21:01:51 -02:00
Bruno Oliveira 3441084bd2 Add progress output for verbose mode with xdist 2017-11-21 21:01:51 -02:00
Bruno Oliveira 8b92527d7d Add re_match_lines and re_match_lines_random to pytester fixture 2017-11-21 21:01:51 -02:00
Bruno Oliveira dab889304e Implement progress percentage reporting while running tests
Fix #2657
2017-11-21 21:01:41 -02:00
Anthony Sottile 219b758949 Add capsysbinary fixture
`capsysbinary` works like `capsys` but produces bytes for `readouterr()`.
2017-11-17 09:02:46 -08:00
Bruno Oliveira 6161bcff6e
Merge pull request #2925 from asottile/capfdbinary
Add capfdbinary fixture
2017-11-17 08:00:10 -02:00
Bruno Oliveira 1f08d990d5 Deprecate metafunc.addcall
Fix #2876
2017-11-15 15:16:00 -02:00
Anthony Sottile 8f90812481 Add capfdbinary fixture
`capfdbinary` works like `capfd` but produces bytes for `readouterr()`.
2017-11-14 14:50:00 -08:00
Bruno Oliveira a6f2d2d2c9 Rename FixtureDef.finalizer to FixtureDef.finalizers 2017-11-12 11:35:46 -02:00
Bruno Oliveira 6d3fe0b826 Explicitly clear finalizers list in finalize to ensure cleanup 2017-11-12 11:28:57 -02:00
Bruno Oliveira bdad345f99 Fix passing request to finish() in FixtureDef 2017-11-12 11:28:26 -02:00
Bruno Oliveira f074fd9ac6 Merge remote-tracking branch 'upstream/features' into malinoff/fix-2124 2017-11-12 11:16:08 -02:00
Bruno Oliveira 6550b9911b pytest_fixture_post_finalizer now receives a request argument 2017-11-12 11:14:55 -02:00
Bruno Oliveira 258031afe5 Merge remote-tracking branch 'upstream/master' into malinoff/fix-2124 2017-11-12 10:34:47 -02:00
Ronny Pfannschmidt f0f2d2b861
Merge branch 'master' into fix-missing-nodeid-with-pyargs 2017-11-11 14:33:55 +01:00
Ronny Pfannschmidt d1af369800
Merge pull request #2913 from nicoddemus/merge-master-into-features
Merge master into features
2017-11-11 10:09:49 +01:00
Ronny Pfannschmidt b671c5a8bf
Merge pull request #2914 from nicoddemus/addfinalizer-refactor
Make SubRequest.addfinalizer an explicit method
2017-11-11 09:26:24 +01:00
Bruno Oliveira f320686fe0 Make SubRequest.addfinalizer an explicit method
This implicit definition really tripped me while debugging #2127,
unfortunately hidden as it was in the middle of all the variable
declarations.

I think the explicit definition is much easier for the eyes and IDEs
to find.
2017-11-11 03:07:34 -02:00
Bruno Oliveira 742f9cb825
Merge pull request #2911 from RonnyPfannschmidt/remove-nodeinfo
remove unused _pytest.runner.NodeInfo class
2017-11-10 18:57:14 -02:00
Bruno Oliveira 983a09a2d4 Merge remote-tracking branch 'upstream/master' into merge-master-into-features 2017-11-10 18:33:02 -02:00
Ronny Pfannschmidt 76f3be452a remove unused _pytest.runner.NodeInfo class 2017-11-10 17:48:52 +01:00
Ronny Pfannschmidt c47dcaa713 switch a special case in scope node lookup to a general one 2017-11-10 17:35:42 +01:00
Bruno Oliveira b11640c1eb Fix linting E722: do not use bare except 2017-11-04 13:59:10 -02:00
Bruno Oliveira 03829fde8a Fix linting E741: ambiguous variable name 2017-11-04 13:59:10 -02:00
Bruno Oliveira e351976ef4 Merge remote-tracking branch 'upstream/features' into RonnyPfannschmidt/introduce-attrs 2017-11-04 12:32:27 -02:00
Ronny Pfannschmidt b18a9deb4c
Merge pull request #2892 from nicoddemus/merge-master-into-features
Merge upstream/master into features
2017-11-04 08:15:28 +01:00
Bruno Oliveira d7e8eeef56
Merge pull request #2878 from RonnyPfannschmidt/collector-makeitem-deprecate
deprecate the public internal PyCollector.makeitem method
2017-11-03 17:13:18 -02:00
Bruno Oliveira 7d43225c36
Merge pull request #2877 from RonnyPfannschmidt/extract-extract-parameterset
move responsibility for parameterset extraction into parameterset class
2017-11-03 16:52:28 -02:00
Bruno Oliveira f3a119c06a Merge upstream/master into features 2017-11-03 16:37:18 -02:00
Ronny Pfannschmidt 07b2b18a01 introduce attrs as dependency and use it
for FixtureFunctionMarker and marks
2017-10-30 17:04:42 +01:00
Bruno Oliveira 766de67392 Fix linting error in deprecated.py 2017-10-30 16:35:34 +01:00
Ronny Pfannschmidt 821f9a94d8 deprecate the public internal PyCollector.makeitem method 2017-10-30 16:35:23 +01:00
Thomas Hisch 2f993af54a Fix context output handling for doctests
Show full context of doctest source in the pytest output, if the lineno of
failed example in the docstring is < 9.
2017-10-29 20:06:10 +00:00
Samuel Dion-Girardeau b27dde24d6 Use a nametuple for `readouterr()` results
This allows accessing `out` and `err` directly by attribute,
while preserving tuple unpacking.

Also added tests, one for the `capsys` fixture, and one for the
`MultiCapture` class itself.
2017-10-28 14:53:19 -04:00
Ronny Pfannschmidt 4a436f2255 move responsibility for parameterset extraction into parameterset class 2017-10-27 17:55:07 +02:00
Sviatoslav Abakumov fd7bfa30d0 Put imports on the last line unless there are other exprs 2017-10-25 11:05:07 +03:00
Sviatoslav Abakumov 3427d27d5a Try to get docstring from module node 2017-10-25 10:54:43 +03:00
Ronny Pfannschmidt def471b975 Merge pull request #2869 from nicoddemus/merge-master-into-features
Merge master into features
2017-10-25 09:08:08 +02:00
Ronny Pfannschmidt f743e95cfc Merge pull request #2791 from OfirOshir/features
bugfix for issue #2491
2017-10-25 09:04:01 +02:00
Bruno Oliveira 4e581b637f Use zip and map from six 2017-10-24 22:13:32 -02:00
Bruno Oliveira 6b86b0dbfe Fix additional linting issues 2017-10-24 21:01:00 -02:00
Bruno Oliveira bdab29fa3d Merge pull request #2867 from Perlence/ini-markers-whitespace
Strip whitespace from markers in INI config
2017-10-24 20:11:20 -02:00
Bruno Oliveira 6821d36ca5 Merge remote-tracking branch 'upstream/master' into merge-master-into-features 2017-10-24 19:57:14 -02:00
Sviatoslav Abakumov 52aadcd7c1 Strip whitespace from markers in INI config
Resolves #2856.
2017-10-24 14:18:39 +03:00
Tom Dalton f5e72d2f5f Unused import / lint 2017-10-24 11:25:42 +01:00
Tom Dalton a5ac19cc5e Merge branch 'issue-2836-fixture-collection-bug' of github.com:tom-dalton-fanduel/pytest into issue-2836-fixture-collection-bug 2017-10-24 10:45:06 +01:00
Tom Dalton 14e3a5fcb9 Move the generic separator to a constant 2017-10-24 10:42:16 +01:00
Bruno Oliveira a3ec3df0c8 Add E722 and E741 flake errors to the ignore list
Also fixed 'E704 multiple statements on one line (def)' in python_api
2017-10-23 18:19:15 -02:00
Tom Dalton 655ab0bf8b Address more review comments, fix massive bug I reintroduced in the node-splitting code :-/ 2017-10-23 17:49:49 +01:00
Tom Dalton a7199fa8ab Docstring typo 2017-10-23 16:59:56 +01:00
Tom Dalton d714c196a5 Shorter code, longer docstring 2017-10-23 16:55:35 +01:00
Tom Dalton ee7e1c94d2 Remove redundant if, tidy if-body 2017-10-23 16:12:07 +01:00
Tom Dalton 1e6dc6f8e5 Working (I think) fix for #2836 2017-10-23 13:26:42 +01:00
Ronny Pfannschmidt 083084fcbc Merge pull request #2842 from ceridwen/features
Use funcsigs and inspect.signature to do function argument analysis
2017-10-20 07:49:08 +02:00
Ceridwen 3da28067f3 Replace introspection in compat.getfuncargnames() with inspect/funcsigs.signature 2017-10-19 16:01:26 -07:00
Ronny Pfannschmidt 3f9f4be070 Merge pull request #2845 from jespino/fix/2832
Adding Failed exception to manage maxfail behavior
2017-10-19 09:12:11 +02:00
Bruno Oliveira 537fc3c315 Merge pull request #2824 from dirk-thomas/pytest_addopts_before_initini
get PYTEST_ADDOPTS before calling _initini
2017-10-18 18:35:12 -02:00
Matty G 11b391ff49 Update mark.py 2017-10-17 14:11:07 -07:00
Jesús Espino 00d3abe6dc Adding Failed exception to manage maxfail behavior 2017-10-17 21:32:20 +02:00
je eaf38c7239 call path.read(), add tests, add news fragment 2017-10-14 00:49:54 +08:00
je b29a9711c4 ignore valid setup.py during --doctest-modules 2017-10-14 00:49:45 +08:00
Ronny Pfannschmidt c750a5beec Merge pull request #2794 from thisch/catchlog
Merge pytest-catchlog plugin
2017-10-12 09:02:46 +02:00
Ronny Pfannschmidt df37cdf51f Merge pull request #2808 from georgeyk/allow-module-level-skip
Allow module level skip
2017-10-12 06:50:53 +02:00
Thomas Hisch af75ca435b Fix some coding-style issues in the logging plugin 2017-10-12 02:19:24 +02:00
Thomas Hisch 775f4a6f2f Fix flake8 issue 2017-10-12 02:19:24 +02:00
Thomas Hisch 0e83511d6d Rename name of registered logging plugin 2017-10-12 02:19:24 +02:00
Thomas Hisch 1f3ab118fa Remove usage of get_logger_obj 2017-10-12 02:19:24 +02:00
Thomas Hisch 0ec72d0745 Improve get_option_ini and get_actual_log_level 2017-10-12 02:19:24 +02:00
Dirk Thomas 66e9a79472 get PYTEST_ADDOPTS before calling _initini 2017-10-11 09:38:44 -07:00
hugovk ef732fc51d Remove code for unsupported Python versions 2017-10-10 08:54:56 +03:00
Ronny Pfannschmidt dd45f8ba6c Merge pull request #2822 from RonnyPfannschmidt/nomore-py26
Nomore py26
2017-10-10 07:00:08 +02:00
Ronny Pfannschmidt c486598440 remove some support code for old python versions 2017-10-09 17:25:13 +02:00
Bruno Oliveira 059455b45d Merge pull request #2773 from RonnyPfannschmidt/fix-markeval-2767
refactor mark evaluators
2017-10-09 12:17:15 -03:00
Ronny Pfannschmidt 9b0ce535c9 Merge pull request #2801 from nicoddemus/capture-fixture
Allow fixtures to use capsys and capfd
2017-10-09 15:26:50 +02:00
Leonard Lausen e89abe6a40 Defensive fallback in case of kwargs not being present 2017-10-09 00:37:27 +09:00
Leonard Lausen c24ffa3b4c Fix pytest.parametrize when argnames are specified as kwarg 2017-10-08 12:23:26 +09:00
Ronny Pfannschmidt 459cc40192 skipping: cleanup
remove dead comments
fix naming
remove dead code
2017-10-06 10:44:49 +02:00
Ronny Pfannschmidt e3b73682b2 flake8 fix 2017-10-06 10:44:49 +02:00
Ronny Pfannschmidt 8480075f01 resuffle markevaluator internal structure 2017-10-06 10:44:49 +02:00
Ronny Pfannschmidt 9ad2b75038 skipping: replace _evalskip with a more consistent _skipped_by_mark 2017-10-06 10:44:49 +02:00
Ronny Pfannschmidt a33650953a remove unused import 2017-10-06 10:44:49 +02:00
Ronny Pfannschmidt 667e70f555 switch out the placeholder MarkEvaluator in unittest plugin 2017-10-06 10:44:49 +02:00
George Y. Kussumoto 03ce0adb79 Fix: handle CollectReport in folded_skips function 2017-10-04 19:18:55 -03:00
Bruno Oliveira e7a4d3d8cf Merge remote-tracking branch 'upstream/master' into features 2017-10-04 17:28:34 -03:00
Bruno Oliveira df6d5cd4e7 Use ascii_escaped to escape unicode warnings 2017-10-03 12:19:37 -03:00
Bruno Oliveira fbb9e9328b Fix warning about non-ascii warnings even when they are ascii
Fix #2809
2017-10-03 07:39:53 -03:00
George Y. Kussumoto c1aa63c0bb Fix docstring alignment and typos 2017-10-02 21:24:52 -03:00
George Y. Kussumoto 79d3353081 Add allow_module_level kwarg to skip helper 2017-10-02 21:07:21 -03:00
Xuan Luong 7093d8f65e Add example of -k 'not test' in help text 2017-09-30 18:43:20 -04:00
Bruno Oliveira f9589f7b64 Resume output capturing after capsys/capfd.disabled() context manager
Fix #1993
2017-09-29 17:24:31 -03:00
Christian Boelsen 794d4585d3 Remove unnecessary complexity in _check_initialpaths_for_relpath(). 2017-09-28 20:53:50 +01:00
Bruno Oliveira 3b30c93f73 Deprecate TerminalReporter._tw
Fix #2803
2017-09-27 17:16:34 -03:00
Bruno Oliveira 22f338d74d Refactor some names for better understanding and consistency 2017-09-26 20:09:42 -03:00
Bruno Oliveira 9919269ed0 Allow to use capsys and capfd in other fixtures
Fix #2709
2017-09-26 20:09:36 -03:00
Thomas Hisch ad21d5cac4 Remove pytest-capturelog backward compat code 2017-09-26 23:24:27 +02:00
Thomas Hisch 2559ec8bdb use 'formatter' kwarg of catching_logs 2017-09-22 22:27:50 +02:00
Thomas Hisch 207f153ec1 Remove logging_at_level ctx manager 2017-09-22 22:27:50 +02:00
Thomas Hisch 3a4011585f catching_logs: Remove usage of 'closing' ctx manager
The 'closing' context manager is only needed for the log_file_handler.
2017-09-22 22:27:50 +02:00
Thomas Hisch 57f66a455a catching_logs: Remove unused 'filter' kwarg 2017-09-22 22:27:50 +02:00
Thomas Hisch e41fd52e8c Introduce live_logs context manager 2017-09-22 22:27:50 +02:00
Thomas Hisch 08f6b5f4ea Use pytest.hookimpl instead of pytest.mark.hookwrapper
pytest.mark.hookwrapper seems to be used nowhere in the _pytest package.
2017-09-22 22:27:50 +02:00
Thomas Hisch d13e17cf51 Don't modify the 'config' object in __init__ 2017-09-22 22:27:50 +02:00
Thomas Hisch f1f6109255 Remove _catchlog_ prefix 2017-09-22 22:27:50 +02:00
Thomas Hisch 87b8dc5afb Move 'config' handling from pytest_configure to __init__ 2017-09-22 22:27:50 +02:00
Thomas Hisch fc965c1dc5 Remove outdated docstring 2017-09-22 22:27:50 +02:00
Thomas Hisch a1bd54e4ea Clean-up LogCaptureHandler 2017-09-22 22:27:50 +02:00
Thomas Hisch 36cceeb10e Set type of log_print ini-variable to 'bool' 2017-09-22 22:27:50 +02:00
Thomas Hisch 98209e92ee Remove superfluous whitespace in docstring 2017-09-22 22:27:50 +02:00
Thomas Hisch 1bea7e6985 Cleanup pytest_addoption 2017-09-22 22:27:50 +02:00
Thomas Hisch 6607478b23 Add unittests for LoggingPlugin (excluding perf tests) 2017-09-22 22:27:49 +02:00
Thomas Hisch 8eafbd05ca Merge the pytest-catchlog plugin 2017-09-22 22:27:49 +02:00
Ofir 062a0e3e68 If an exception happens while loading a plugin, PyTest no longer hides the original traceback.
In python2 it will show the original traceback with a new message that explains in which plugin.
 In python3 it will show 2 canonized exceptions, the original exception while loading the plugin in addition to an exception that PyTest throws about loading a plugin.
2017-09-19 15:14:08 +03:00
Oliver Bestwalter 2802135741
fix 'DoctestItem' object has no attribute '_fixtureinfo'
* doxtests don't seem to have this attribute, so nothing will be written in that case.
* tried to be a good boy scout and tidied up surrounding code a bit (comments, shadowed/unused names, removed random new lines, naming things)
2017-09-19 12:41:12 +02:00
Bruno Oliveira 3ebfb881c9 Merge remote-tracking branch 'upstream/master' into features 2017-09-18 19:10:31 -03:00
Bruno Oliveira ac5c5cc1ef Merge pull request #2750 from evanunderscore/fix-filescompleter
Fix crash in FastFilesCompleter with no prefix
2017-09-14 20:11:43 -03:00
Christian Boelsen 14b6380e5f Fix #2775 - running pytest with "--pyargs" will result in Items with empty "parent.nodeid" if run from a different root directory 2017-09-13 17:15:32 +01:00
Xuan Luong 1e93089165 [bugfix] Checking MarkDecorator equality returns False for non-MarkDecorator object 2017-09-09 01:31:08 -04:00
Bruno Oliveira 9273e11f21 Merge branch 'master' into features 2017-09-07 13:59:10 -03:00
Evan 6cf515b164 Fix crash in FastFilesCompleter with no prefix 2017-09-08 00:14:56 +10:00
Ronny Pfannschmidt 6967f3070e Merge pull request #2711 from massich/mimic_raises_signature_in_warns
[MRG][feature] Change warns signature to mimic the raises call
2017-09-07 13:19:09 +02:00
Joan Massich 80d165475b Add documentation 2017-09-07 10:28:52 +02:00
Joan Massich aa6a67044f Add match_regex functionality to warns 2017-09-07 09:58:03 +02:00
Bruno Oliveira d01f08e96f Merge branch 'features' into pluggy-master 2017-09-06 13:13:35 -03:00
Ronny Pfannschmidt ad36407747 Merge pull request #2700 from nicoddemus/staticmethods-fixtures
Allow tests declared as @staticmethod to use fixtures
2017-09-06 08:24:00 +02:00
Bruno Oliveira e1f2254fc2 Merge pull request #2734 from RonnyPfannschmidt/simplify-string-safening
simplyfy ascii escaping by using backslashreplace error handling
2017-09-05 21:14:27 -03:00
Bruno Oliveira f825b4979b Merge remote-tracking branch 'upstream/master' into features 2017-09-05 19:44:33 -03:00
Bruno Oliveira 1fc185b640 Add comment about possible future refactoring in the fixture mechanism 2017-09-05 19:28:39 -03:00
Tarcisio Fischer 8d1903fed3 Avoid creating arbitrary filenames for tmpdir on Testdir's constructor
Fixes #2751
2017-09-05 15:22:04 -03:00
Ronny Pfannschmidt 13eac944ae restore ascii escaping for python 3.3/3.4 2017-09-04 21:25:46 +02:00
Bruno Oliveira 3dc0da9339 Remove __multicall__ warning and usages in testing
pluggy>=0.5 already warns about those
2017-09-01 18:53:06 -03:00
Ronny Pfannschmidt 181bd60bf9 Merge pull request #2742 from nicoddemus/resultlog-deprecation
Improve user guidance regarding ``--resultlog`` deprecation
2017-09-01 08:29:41 +02:00
Bruno Oliveira 3288c9a110 Improve user guidance regarding ``--resultlog`` deprecation
Fix #2739
2017-08-31 19:11:41 -03:00
Bruno Oliveira 221797c609 Encode utf-8 byte strings in pytester's makefile
Fix #2738
2017-08-31 18:49:06 -03:00
Ronny Pfannschmidt 5e00549ecc Merge pull request #2735 from fgmacedo/fgm-fix-reprfuncargs-toterminal
2731.bug Fix ReprFuncArgs with mixed unicode and utf-8 args.
2017-08-31 09:36:56 +02:00
Fernando Macedo 59cdef92be fixes #2731 ReprFuncArgs with mixed unicode and utf-8 args 2017-08-30 16:06:12 -03:00
Ronny Pfannschmidt 78a027e128 simplyfy ascii escaping by using backslashreplace error handling 2017-08-30 16:43:16 +02:00
Tyler Goodlet ff35c17ecf Drop wrapper module; import directly 2017-08-25 11:46:55 -04:00
Tyler Goodlet 9ab83083d1 Update docs 2017-08-24 16:53:37 -04:00
Tyler Goodlet 333a9ad7fa Stop vendoring pluggy
Resolves #2716
2017-08-24 15:54:33 -04:00
Kirill Pinchuk 12b1bff6c5 `compat.safe_getattr` now catches OutcomeExceptions too 2017-08-23 17:17:03 +03:00
Bruno Oliveira a993add783 Allow tests declared as @staticmethod to use fixtures
Fix #2699
2017-08-17 20:44:19 -03:00
Bruno Oliveira f18780ed8a Update docs: ``match`` keyword was introduced in 3.1
Also update the text to recommend using the context-manager
over the callable/string forms.
2017-08-16 14:28:34 -03:00
Ronny Pfannschmidt 5c0feb2877 Merge pull request #2680 from prokaktus/skipping-same-module
Fold skipped tests with global pytestmark variable
2017-08-15 10:52:24 +02:00
prokaktus 98bf5fc9be Fold skipped tests with global pytestmark variable 2017-08-15 02:18:46 +03:00
Andreas Pelme 39331856ed Use the correct stacklevel for getfuncargvalue() deprecation warning.
Fixed #2681.
2017-08-13 14:59:33 +02:00
Ronny Pfannschmidt eb462582af fix #2675 - store marks correctly in callspecs 2017-08-10 19:46:36 +02:00
Bruno Oliveira cc0f2473eb Fix windows console workaround error with non-standard io-streams
Fix #2666
2017-08-07 20:57:13 -03:00
Srinivas Reddy Thatiparthy a0101f024e remove os.sep as it behaves differently linux and windows.
* on linux it is '/'

* on windows it is '\'
2017-08-05 23:21:43 +05:30
Ronny Pfannschmidt 9e62a31b63 Merge pull request #2650 from srinivasreddy/2642
Fixed#2642: Convert py module references to six module
2017-08-04 09:21:51 +02:00
Srinivas Reddy Thatiparthy dc563e4954 convert py module references to six module 2017-08-04 08:05:03 +05:30
Bruno Oliveira ad52f714a9 Fix small terminal glitch when collecting a single test item
Fix #2579
2017-08-03 20:57:46 -03:00
Bruno Oliveira 7703dc921c Only skip null bytes before setting the environment variable
As discussed, node ids have already been "ascii" sanitized by the
parametrization process
2017-08-02 10:27:45 -03:00
Bruno Oliveira 1deac2e210 Properly escape test names when setting PYTEST_CURRENT_TEST environment variable
Fix #2644
2017-08-01 20:52:37 -03:00
Ronny Pfannschmidt 6e7547244b Merge pull request #2636 from RonnyPfannschmidt/remove-preinit
remove preinit, its no longer needed
2017-08-01 05:22:41 +02:00
Bruno Oliveira 8a2e6a8d51 Fix linting 2017-07-31 16:49:30 -03:00
Ronny Pfannschmidt 74d536314f pytester: make pytest fullpath a constant 2017-07-31 18:18:53 +02:00
Ronny Pfannschmidt ceb016514b remove dead code - Node._memoizedcall 2017-07-31 18:18:26 +02:00
Ronny Pfannschmidt e90f876b34 remove the last own implementation of pytest_namespace 2017-07-31 13:48:25 +02:00
Ronny Pfannschmidt c68a89b4a7 remove preinit, its no longer needed 2017-07-31 13:44:05 +02:00