Jeffrey Rackauckas
307cd6630f
Add the ability to use platform in pytest.mark.skipif
2018-02-25 22:38:25 -08:00
Ronny Pfannschmidt
da3f4045e7
Merge pull request #3250 from RonnyPfannschmidt/mark-package
...
Mark package
2018-02-24 18:19:27 +01:00
William Lee
f4cc45bb41
Turn on the continue on failure only when the flag is given
2018-02-23 22:31:11 -06:00
William Lee
7f2dd74ae9
Fixed test for the continue run
2018-02-23 21:20:14 -06:00
feuillemorte
c032d4c5d5
Merge branch 'features' of https://github.com/feuillemorte/pytest into 3034-new-tests-first
2018-02-23 23:55:28 +03:00
feuillemorte
e865f2a235
#3034 Fix comments
2018-02-23 22:49:17 +03:00
William Lee
8d90591b33
Merge remote-tracking branch 'upstream/features' into continue-on-failure
2018-02-22 21:01:31 -06:00
William Lee
fbc45be83f
Fixed #3149 where doctest does not continue to run when there is a failure
2018-02-22 21:00:54 -06:00
Bruno Oliveira
bedceaacc4
Merge pull request #3249 from a-feld/request-fixture-reference-cycle
...
Fix PseudoFixtureDef reference cycle.
2018-02-22 19:23:56 -03:00
Bruno Oliveira
60358b6db8
Fix linting
2018-02-22 18:49:20 -03:00
Ronny Pfannschmidt
2cd69cf632
sort out import misstake
2018-02-22 15:18:17 +01:00
Ronny Pfannschmidt
935dd3aaa5
simplify complexyity in mark plugin modifyitems
2018-02-22 15:11:55 +01:00
Ronny Pfannschmidt
c8d24739ed
move current mark datastructures to own module
2018-02-22 14:43:01 +01:00
Ronny Pfannschmidt
be2e3a973e
remove complexity from match_keywords
2018-02-22 14:30:32 +01:00
Ronny Pfannschmidt
cef0423b27
move the keyword/mark matching to the "legacy" module
2018-02-22 14:26:22 +01:00
Ronny Pfannschmidt
25a3e9296a
reduce the complexity of skipping terminal summary
2018-02-22 14:18:49 +01:00
Ronny Pfannschmidt
cf40c0743c
move mark evaluator into mark package
2018-02-22 14:05:10 +01:00
Ronny Pfannschmidt
c31e1a3797
turn mark into a package
2018-02-22 13:36:33 +01:00
Allan Feldman
48548767fc
Use a frozen attr class for PseudoFixtureDef.
2018-02-21 23:15:39 -08:00
Ronny Pfannschmidt
54e63b7dd5
Merge pull request #2770 from HPENetworking/master
...
Make record_xml_property generic and compatible with xdist and markers.
2018-02-22 07:38:55 +01:00
Allan Feldman
75f11f0b65
Fix reference cycle caused by PseudoFixtureDef.
...
Python types have reference cycles to themselves when they are created. This is
partially caused by descriptors which get / set values from the __dict__
attribute for getattr / setattr on classes.
This is not normally an issue since types tend to remain referenced for the
lifetime of the Python process (and thus never become garbage).
However, in the case of PseudoFixtureDef, the class is generated in
_get_active_fixturedef and later discarded when pytest_fixture_setup returns.
As a result, the generated PseudoFixtureDef type becomes garbage.
This is not really a performance issue but it can lead to some problems when
making tests and assertions about garbage when using pytest.
This garbage creation problem can be rectified by returning a namedtuple
instance which is functionally the same. In the modified code, the namedtuple
is allocated / deallocated using reference counting rather than having to use
the garbage collector.
2018-02-21 21:40:54 -08:00
mike
6e14585ca2
Fix approx default tolerances for Decimal
2018-02-21 23:08:23 +01:00
Bruno Oliveira
567b1ea7a1
Move user_properties to the end of parameter list for backward compatibility
2018-02-21 17:56:49 -03:00
Bruno Oliveira
d838193d2d
Add note about deprecating record_xml_property
...
Also make record_xml_property return record_property directly
2018-02-21 17:45:52 -03:00
Bruno Oliveira
7a62619a75
Merge remote-tracking branch 'upstream/master' into features
2018-02-21 10:39:55 -03:00
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
Bruno Oliveira
97bb6abcfa
Merge pull request #3234 from thisch/showcapture_log_support
...
Add captured-log support to --show-capture
2018-02-19 20:46:50 -03: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
3bc8b50a0d
Merge pull request #3228 from thisch/update_attr
...
Update minimal attrs library to v17.4.0
2018-02-17 20:19:07 -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
Jason R. Coombs
4131d3f300
Probably it's best to write the err stream to stderr.
2018-02-17 12:13:33 -05:00
Jason R. Coombs
254e357076
Correct the broken indentation.
2018-02-17 12:10:29 -05:00
Bruno Oliveira
69d608aec3
Merge remote-tracking branch 'upstream/master' into merge-upstream
2018-02-17 09:38:06 -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
Thomas Hisch
82cdc487ce
Fix raised warning when attrs 17.4.0 is used
...
Related: #3223
2018-02-15 21:09:44 +01:00
Jason R. Coombs
435b8ddc7c
Rename method for additional clarity.
2018-02-15 09:17:33 -05:00
Florian Bruhin
3cbf0c8ec0
Raise unexpected exceptions with pytest.raises() using match=
2018-02-15 12:11:56 +01:00
Florian Bruhin
9849022eb2
Remove "matching '...'" part from the pytest.raises message
...
When a test with pytest.raises(ValueError, match='foo') doesn't raise, the
following error is printed:
Failed: DID NOT RAISE <class 'ValueError'> matching 'foo'
This error message is confusing as it implies a ValueError was raised, but the
message wasn't matching 'foo'.
I first considered rewording it somehow to preserve the match pattern in it, but
I don't think that's worthwhile as the pattern should usually be apparent from
the stacktrace anyways (hard-coded, as parametrization, or with --showlocals for
more sophisticated cases).
2018-02-14 19:20:00 +01:00
Jason R. Coombs
18c84a1904
Restrict fix to macOS only. Ref #3215 .
2018-02-13 17:51:20 -05: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
ce1872e7e8
Merge branch 'master' into bugfix/985/disable-output-capturing-in-doctest
2018-02-13 12:33:07 -05:00
Jason R. Coombs
391553887b
Disable output capturing in doctest to avoid losing reference to stdout. Fixes #985 .
2018-02-13 12:08:39 -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
Andy Freeland
e5b527d0e3
Add Sphinx parameter docs for `match` and `message` args to `pytest.raises()`
2018-02-09 16:28:17 -08: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
feuillemorte
da5882c2d5
#1478 Add doc and remove print
2018-02-09 21:36:48 +03: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
Bruno Oliveira
a4cbd03535
Fix linting
2018-02-08 13:22:32 -02:00
feuillemorte
71367881ed
#1478 Added --show-capture=both option (fix comments)
2018-02-08 16:21:22 +03:00
Bruno Oliveira
ad7d63df97
Rename _stream_logs_enabled to _log_cli_enabled and remove _stream_logs
2018-02-08 09:48:51 -02: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
Bruno Oliveira
2d0c1e941e
Fix versionadded tag in caplog function
2018-02-05 20:22:21 -02:00
Pedro Algarvio
0d15a46863
Don't traceback on unkown sections.
2018-02-05 19:09:38 +00:00
Ronny Pfannschmidt
7c80c81433
Merge pull request #3152 from brianmaissy/silently_fail_to_import_during_postmortem
...
If we fail to import doctest.UnexpectedException during postmortem, fail quietly
2018-02-05 10:04:00 +01:00
Brian Maissy
867344d0d7
move import to top
2018-02-04 00:03:17 +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
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
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
Alan Velasco
e12a588c39
Merge branch 'master' into typo_for_parametrize
2018-01-30 16:22:54 -06:00
Alan Velasco
547070e2d8
Switch `for_parameterize` to `for_parametrize`
2018-01-30 16:20:43 -06: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
269eeec702
Replace deprecated option.getvalue by option.getoption in cacheprovider
2018-01-29 08:40:29 -02:00
Bruno Oliveira
0e1be01b7a
Merge pull request #3108 from cheezman34/features
...
Optimize reorder_items in fixtures.py
2018-01-27 23:21:09 -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
Ronny Pfannschmidt
d550c33cd0
s/empty_parameterset/empty_parameter_set_mark
2018-01-26 11:56:24 +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
37b41de779
fix #2527 - introduce a option to pic the empty parameterset action
2018-01-26 11:10:00 +01:00
Ronny Pfannschmidt
bf2c10c810
parameterset: refactor marking empty parametersets
2018-01-26 11:10:00 +01:00
Brian Maissy
2a1b1107c5
If we fail to import doctest.UnexpectedException during postmortem, fail quietly and continue
2018-01-25 22:28:27 +02:00
Alan Velasco
a24ca9872f
Change cache directory name to include `pytest`
2018-01-25 07:50:08 -06:00
feuillemorte
503e00f7ff
#1642 Remove adding rootdir to sys path
2018-01-25 15:57:29 +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
Andrew Toolan
2c7f94fdb9
Added basic fix and test
2018-01-23 21:18:10 -02:00
Bruno Oliveira
b4e8861aa5
Fix typos
2018-01-23 19:02:32 -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
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