Carlos Jenkins
8b49ddfa58
Renamed the fixture record_xml_property to record_property and adapted logic so that the properties are passed to the TestReport object and thus allow compatibility with pytest-xdist.
2018-02-20 15:46:26 -06:00
Thomas Hisch
acda6c46fb
Partially revert "Remove --no-print-logs option"
...
We'll deprecate --no-print-logs beginning with pytest-4.0.
This reverts commit ac7eb63a6b
.
2018-02-19 20:34:11 +01:00
Thomas Hisch
ac7eb63a6b
Remove --no-print-logs option
...
This option is superseded by the --show-capture option. With --no-print-logs
it was possible to only disable the reporting of captured logs, which is no
longer possible with --show-capture. If --show-capture=no is used, no
captured content (stdout, stderr and logs) is reported for failed tests.
2018-02-18 20:48:07 +01:00
Thomas Hisch
51ece00923
Add captured-log support to --show-capture
...
Fixes : #3233
2018-02-18 20:18:37 +01:00
Bruno Oliveira
b486e1294b
Merge pull request #3222 from The-Compiler/match-msg
...
Remove "matching '...'" part from the pytest.raises message
2018-02-17 21:18:05 -02:00
Bruno Oliveira
9d879bee36
Merge pull request #3215 from pytest-dev/bugfix/985/disable-output-capturing-in-doctest
...
Disable output capturing in doctest
2018-02-17 18:39:32 -02:00
Brian Maissy
069f32a8c4
print captured logs before entering pdb
2018-02-17 20:32:49 +02:00
Bruno Oliveira
69d608aec3
Merge remote-tracking branch 'upstream/master' into merge-upstream
2018-02-17 09:38:06 -02:00
Bruno Oliveira
dfbaa20240
Bring test_live_logs_unknown_sections directly due to merge conflicts
2018-02-17 09:36:46 -02:00
Bruno Oliveira
fa8354e872
Merge pull request #3213 from thisch/collection_deselection
...
Show deselection count before tests are executed
2018-02-17 09:03:26 -02:00
Bruno Oliveira
00d3001138
Merge pull request #3188 from s0undt3ch/issues/3184
...
Don't traceback on unkown sections.
2018-02-17 09:02:44 -02:00
Bruno Oliveira
05faa69c37
Merge pull request #3194 from s0undt3ch/feature/logstart-logfinish
...
Fix issue where a new line was always written for the live log finish section
2018-02-16 21:19:38 -02:00
Jordan Speicher
774c539f1a
Add --deselect command line option
...
Fixes #3198
2018-02-16 08:17:37 -06:00
Bruno Oliveira
6bc45d158d
Merge pull request #3186 from brianmaissy/bugfix/print_captured_stdout_before_entering_pdb
...
Added printing of captured stdout before entering pdb
2018-02-15 19:38:23 -02:00
Florian Bruhin
3cbf0c8ec0
Raise unexpected exceptions with pytest.raises() using match=
2018-02-15 12:11:56 +01:00
Thomas Hisch
6496131b79
Show deselection count before tests are exectued
...
Fixes #1527
2018-02-13 22:27:02 +01:00
feuillemorte
dff0500114
#3034 Added new option "--new-first"
2018-02-13 22:49:28 +03:00
Jason R. Coombs
247cdb835a
Remove xfail; tests now pass on macOS. Ref #985 .
2018-02-13 12:41:19 -05:00
Brian Maissy
7656fc8320
Added printing of captured stdout and stderr before entering pdb
2018-02-12 23:17:51 +02:00
Marcin Bachry
b6166dccb4
Fix mock patchings detection when both mock and unittest.mock are present
2018-02-12 20:29:37 +01:00
Bruno Oliveira
063e2da967
Merge pull request #3176 from feuillemorte/1478_no_stdout_option
...
#1478 Added --no-stdout option
2018-02-09 18:36:36 -02:00
Pedro Algarvio
d776e5610e
Fix issue where a new line was always written for the live log finish section
2018-02-09 11:17:01 +00:00
feuillemorte
71367881ed
#1478 Added --show-capture=both option (fix comments)
2018-02-08 16:21:22 +03:00
Pedro Algarvio
0b71255dda
Expose `log_cli` as a CLI parser option.
2018-02-08 09:42:53 +00:00
Bruno Oliveira
ce0a9aadec
Merge pull request #3127 from feuillemorte/1642-add-rootdir-option
...
#1642 add rootdir option
2018-02-07 18:18:59 -02:00
Bruno Oliveira
f72182977d
Merge pull request #3183 from cheezman34/master
...
Fix ordering of tests to minimize fixture creating
2018-02-07 18:15:41 -02:00
Bruno Oliveira
ed12cf3fb3
Merge pull request #3189 from s0undt3ch/feature/logstart-logfinish
...
Additionally handle logstart and logfinish hooks
2018-02-07 18:09:45 -02:00
feuillemorte
1a650a9eb9
#1478 Added --show-capture option
2018-02-06 23:38:51 +03:00
Pedro Algarvio
67558e0e22
Additionally handle logstart and logfinish hooks
2018-02-06 15:45:36 +00:00
Pedro Algarvio
0d15a46863
Don't traceback on unkown sections.
2018-02-05 19:09:38 +00:00
Brian Maissy
e64feaba7a
xfail is better than skip
2018-02-03 23:28:37 +02:00
Brian Maissy
74633815aa
skip failing pdb/doctest test on mac
2018-02-03 23:24:11 +02:00
Thomas Hisch
c0ef4a4d35
Add captured log msgs to junit xml file
...
For each test this adds the captured log msgs to a system-* tag in the junit
xml output file. The destination of the system-* tag is specified by
junit_logging ini option.
2018-02-03 09:39:29 +01:00
Bruno Oliveira
8c81722a0c
Merge pull request #3167 from nicoddemus/fix-py37
...
Fix test for py37
2018-02-02 17:13:00 -02:00
Aaron
4458e65fe7
Fix ordering of tests to minimize fixture creating
2018-02-01 13:07:45 -08:00
feuillemorte
3eb6cad222
#1642 Fix comments
2018-02-01 11:20:37 +03:00
feuillemorte
936651702b
#1642 Fix tests
2018-02-01 00:27:48 +03:00
feuillemorte
9f1772e679
#1642 Resolve conflicts
2018-02-01 00:18:28 +03:00
feuillemorte
741b571f3b
#1642 fix tests and config.py
2018-02-01 00:03:24 +03:00
feuillemorte
949a620d3a
#1478 Added --no-stdout option
2018-01-31 22:36:28 +03:00
Bruno Oliveira
90a8faabba
Fix test for py37
...
In previous Python versions, the list of warnigns appears like:
... list of emitted warnings is: [UserWarning('user',)].
In Python 3.7 apparently the string representation has been improved to:
... list of emitted warnings is: [UserWarning('user')].
Fix #3011
2018-01-30 20:33:07 -02:00
Thomas Hisch
ebab1b6c69
live-logging: Colorize levelname
2018-01-30 18:21:12 +01:00
Bruno Oliveira
49773b573f
Merge pull request #3132 from raphaelcastaneda/feature/add-record-xml-attribute
...
implement #3130 - add record_xml_attribute fixture
2018-01-29 15:42:55 -02:00
Bruno Oliveira
6e4efccc38
Rename test_cache to test_cacheprovider for consistency with cacheprovider
2018-01-29 08:40:29 -02:00
Bruno Oliveira
aff463a3c4
Merge remote-tracking branch 'upstream/master' into features
2018-01-27 12:28:43 -02:00
Bruno Oliveira
b3247c1d03
Merge pull request #3044 from RonnyPfannschmidt/parameterset-empty-enable-xfail
...
empty parameterset - enable opt to xfail
2018-01-27 12:23:49 -02:00
Bruno Oliveira
cd0b2ace67
Merge pull request #3150 from alanbato/pytest_cache
...
Change cache directory structure to include `pytest`
2018-01-27 10:08:56 -02:00
Ronny Pfannschmidt
17a1ed5edf
use a constant to sort out repeated use of the EMPTY_PARAMETERSET_OPTION
2018-01-26 12:12:26 +01:00
Ronny Pfannschmidt
a54cd4c2fd
correct testing and usage of the empty_parameter_set_mark config option
2018-01-26 12:05:52 +01:00
Bruno Oliveira
a58099022a
Merge pull request #3124 from nicoddemus/logging-3013
...
Changes in the logging plugin for 3.4
2018-01-26 08:52:43 -02:00
Ronny Pfannschmidt
d4c11e58aa
exted empty parameterset check with reason test
2018-01-26 11:18:50 +01:00
Ronny Pfannschmidt
7f83605c81
fix empty parameterset tests by mocking a config object
2018-01-26 11:10:00 +01:00
Ronny Pfannschmidt
37b41de779
fix #2527 - introduce a option to pic the empty parameterset action
2018-01-26 11:10:00 +01:00
Alan Velasco
a24ca9872f
Change cache directory name to include `pytest`
2018-01-25 07:50:08 -06:00
feuillemorte
0cfa975930
#1642 Fix tests
2018-01-25 15:57:04 +03:00
Bruno Oliveira
b8be339632
Merge pull request #3148 from nicoddemus/deprecate-old-style-classes-2147
...
All classes now subclass object for better py3 compatibility
2018-01-25 10:41:28 -02:00
Bruno Oliveira
15cbd61159
Change caplog.get_handler(when) to caplog.get_records(when)
...
While updating the docs I noticed that caplog.get_handler() exposes
the underlying Handler object, which I think it is a bit too much
detail at this stage. Update to return the records directly instead.
2018-01-24 19:08:49 -02:00
Bruno Oliveira
af37778b0d
All classes now subclass object for better py3 compatibility
...
Fix #2147
2018-01-24 18:23:42 -02:00
Bruno Oliveira
3f5e9ea71e
Fix -o behavior to no longer swallow all remaining options
...
The current behavior was too error-prone because a "-o" option would
swallow all the following non-option parameters:
pytest -o foo=bar path/to/test.py
path/to/test.py would be captured by the -o option, and would fail
because "path/to/test.py" is not in the format "key=value".
2018-01-23 21:19:16 -02:00
Bruno Oliveira
8426c57a9e
Ensure changes in the message in the future do not make the test pass by accident
2018-01-23 21:18:59 -02:00
Aron Coyle
203508d9f3
cleanup test cases
2018-01-23 21:18:37 -02:00
Andrew Toolan
2c7f94fdb9
Added basic fix and test
2018-01-23 21:18:10 -02:00
Bruno Oliveira
113bfb6be8
Report 'call' phase as 'live log call'
...
As commented in review, this makes it consistent with the headers shown
by stdout/stderr capturing ("Captured log call")
2018-01-22 21:43:35 -02:00
Bruno Oliveira
9f4688e549
Remove unnecessary -s from test_log_cli_enabled_disabled
2018-01-22 21:26:14 -02:00
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
feuillemorte
83034bbd48
#1642 Fix rootdir option
2018-01-20 22:30:01 +03:00
Bruno Oliveira
2e40a8b3ca
Fix test_caplog_captures_for_all_stages by setting log level
2018-01-20 12:04:28 -02:00
Bruno Oliveira
18e053546c
Use six.StringIO and __name__ in test_live_logging_suspends_capture
2018-01-20 12:02:55 -02:00
Bruno Oliveira
9dbcac9af3
Suspend stdout/stderr capturing when emitting live logging messages
2018-01-20 12:02:55 -02:00
Bruno Oliveira
4a436572a8
Simplify test assertions a bit
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
4a18d76160
#1642 remove print
2018-01-17 23:14:40 +03:00
feuillemorte
d784155fd2
#1642 Add rootdir option
2018-01-17 23:02:31 +03:00
feuillemorte
8433e2ba04
#2953 fix comments: fix exception type
2018-01-16 23:35:57 +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
Brian Maissy
4a3863c2e2
use flush in order to avoid hanging on mac
2018-01-14 23:00:23 +02:00
Bruno Oliveira
5939b336cd
Fix progress report when tests fail during teardown
...
Fix #3088
2018-01-11 20:42:05 -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
Anthony Sottile
205e29d843
Remove unnecessary `# noqa` comments.
...
Commit automated with https://github.com/asottile/yesqa
2017-12-22 08:29:48 -08: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
afc607cfd8
move node base classes from main to nodes
2017-12-18 11:08:20 +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
Bruno Oliveira
924b5e2e3d
Merge pull request #3031 from nicoddemus/symlink-privileges
...
Check if symlink does have privileges on Windows for test_cmdline_python_package_symlink
2017-12-16 12:36:11 -02: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
586ecea6f2
Check if symlink does not privileges on Windows for test_cmdline_python_package_symlink
...
os.symlink might fail on Windows because users require a special policy
to create symlinks (argh).
This is not a problem on AppVeyor because it is logged in as an admin,
but would be surprising for Windows users running pytest's test
suite on their computer.
2017-12-14 19:23:15 -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
Ronny Pfannschmidt
476d4df1b7
Merge pull request #3010 from cryvate/fix-issue-2985
...
Improve handling of pyargs
2017-12-13 13:56:42 +01:00
Antony Lee
c8e7d1ae34
Respect PYTEST_DONT_REWRITE for plugins too.
2017-12-12 17:43:17 -08:00