Commit Graph

413 Commits

Author SHA1 Message Date
Bruno Oliveira ef97121d42 Removed unused ConftestImportFailure.__str__ method 2018-10-12 10:57:13 -03:00
Bruno Oliveira 2cb3534679 Move filter_traceback to _pytest._code 2018-10-12 10:19:50 -03:00
Bruno Oliveira 8e11fe5304 Improve tracebacks for ImportErrors in conftest.py files
Fix #3332
2018-10-12 10:10:55 -03:00
Bruno Oliveira 36dc671843 New ExceptionInfo.getrepr 'chain' parameter to be able to suppress chained exceptions 2018-10-12 10:08:55 -03:00
Bruno Oliveira 933de16fe4
Merge pull request #3988 from RonnyPfannschmidt/tmpdir-port-pathlib
Tmpdir port pathlib
2018-10-12 08:33:47 -03:00
Bruno Oliveira e8348a1d12
Merge pull request #4077 from nicoddemus/short-usage-errors
Improve internal error messages
2018-10-12 08:18:07 -03:00
Ronny Pfannschmidt 4736b2bdfb address review comments 2018-10-11 20:48:30 +02:00
Anthony Sottile 8ecdd4e9ff
Merge pull request #4104 from asottile/deprecated_call_match
Implement pytest.deprecated_call with pytest.warns
2018-10-11 08:20:13 -07:00
Daniel Hahler b3940666a7
Merge pull request #4103 from blueyed/conftest
conftest: optimize _getconftestmodules
2018-10-11 13:52:48 +02:00
Ronny Pfannschmidt 16e2737da3 implement tmp_path_factory and deprecate pytest.ensuretemp as intended 2018-10-11 09:41:37 +02:00
Ronny Pfannschmidt 36c2a101cb add missing docstring 2018-10-11 07:15:09 +02:00
Ronny Pfannschmidt ebd597b2fd use the constant for lock timeouts 2018-10-11 07:15:09 +02:00
Ronny Pfannschmidt 94829c391b make tmpdir env cleanup idempotent 2018-10-11 07:15:09 +02:00
Ronny Pfannschmidt b82d6f7a0b pytester: use per test tmproot 2018-10-11 07:15:09 +02:00
Ronny Pfannschmidt 4a436b5470 resolve in code review commments 2018-10-11 07:15:09 +02:00
Ronny Pfannschmidt 3036914097 sort out rmtree expectations 2018-10-11 07:15:09 +02:00
Ronny Pfannschmidt 2831cb9ab5 unify paths.py and pathlib.py 2018-10-11 07:15:09 +02:00
Ronny Pfannschmidt 85cc9b8f12 move all the things into _pytest.pathlib 2018-10-11 07:15:08 +02:00
Ronny Pfannschmidt fed4f73a61 ignore rmtree errors 2018-10-11 07:15:08 +02:00
Ronny Pfannschmidt d76fa59b35 fix lock timeouts for good this time 2018-10-11 07:15:08 +02:00
Ronny Pfannschmidt 2532dc1dbb fix up lock consideration argument 2018-10-11 07:15:08 +02:00
Ronny Pfannschmidt 642cd86dd1 shape up removal and lock destruction 2018-10-11 07:15:08 +02:00
Ronny Pfannschmidt b3a5b0ebe1 remove path from exposure 2018-10-11 07:15:08 +02:00
Ronny Pfannschmidt 8b4a29357e fix typo 2018-10-11 07:15:08 +02:00
Ronny Pfannschmidt ab3637d486 implement cleanup for unlocked folders 2018-10-11 07:15:08 +02:00
Ronny Pfannschmidt 66a690928c bring in purepath and fix an assertion 2018-10-11 07:15:08 +02:00
Ronny Pfannschmidt 8e00280fc1 fix linting 2018-10-11 07:15:08 +02:00
Ronny Pfannschmidt d053cdfbbb factor out max and iterate on locks and cleanups 2018-10-11 07:15:08 +02:00
Ronny Pfannschmidt 2e39fd89d1 add python27 support by using reduce instead of max 2018-10-11 07:15:08 +02:00
Ronny Pfannschmidt b48e23d54c port interals of tmpdir to a basic pathlib implementation
this is still lacking locking and cleanup of the folders
2018-10-11 07:15:08 +02:00
Bruno Oliveira c9a85b0e78 Fix linting 2018-10-10 19:54:39 -03:00
Bruno Oliveira bf265a424d Minor adjustments found during code review 2018-10-10 19:35:49 -03:00
Bruno Oliveira 5436e42990 Use pytest.fail(..., pytrace=False) when treating user errors
This prevents an enormous and often useless stack trace from showing
to end users.

Fix #3867
Fix #2293
2018-10-10 19:16:53 -03:00
Bruno Oliveira 67f40e18a7 Use attr.s(repr=False) because we customize MarkInfo's repr 2018-10-10 19:13:34 -03:00
Daniel Hahler 52ff1eaf37 _getconftestmodules: optimize 2018-10-10 21:30:33 +02:00
Daniel Hahler 602e74c2a7
Merge pull request #4107 from blueyed/__tracebackhide__
pytester: fix __tracebackhide__ for {re_,fn}match_lines
2018-10-10 20:55:32 +02:00
Daniel Hahler 4c9015c3b1
Merge pull request #4105 from blueyed/repr
Fix trailing whitespace in FixtureDef.__repr__
2018-10-10 19:28:32 +02:00
Niklas JQ c14a23d4e4 Fix #4093: multiple string literals on a line 2018-10-10 19:28:31 +02:00
Daniel Hahler b8fc3e569a pytester: fix __tracebackhide__ for {re_,fn}match_lines 2018-10-10 19:27:43 +02:00
Anthony Sottile e0f6fce9e9 In python2, display previously warned warnings 2018-10-10 09:37:21 -07:00
Daniel Hahler d93de6cc67 Fix trailing whitespace in FixtureDef.__repr__ 2018-10-10 18:14:56 +02:00
Anthony Sottile aeb92accb2 Implement pytest.deprecated_call with pytest.warns 2018-10-10 08:03:23 -07:00
Bruno Oliveira 9a3836a0cf Merge remote-tracking branch 'upstream/master' into merge-master-into-features 2018-10-09 19:34:04 -03:00
Anthony Sottile 11a07211b6 re-enable linting tox env on windows 2018-10-09 13:01:51 -07:00
Anthony Sottile 65545d8fb2 Manual fixups of black formatting 2018-10-08 10:12:42 -07:00
Anthony Sottile 1caf6d5907 Upgrade pre-commit hooks 2018-10-08 10:10:46 -07:00
Jeffrey Rackauckas fc11b81005 Exclude durations that are 0.00 seconds long. 2018-10-07 19:19:48 -07:00
Kyle Altendorf ccaec8d360 __tracebackhide__ = True 2018-10-06 21:57:03 -04:00
Ronny Pfannschmidt 66609665f2
Merge pull request #4076 from nicoddemus/unittest-param-fixture-msg
Improve error message when TestCase functions use a parametrized fixture
2018-10-06 07:43:57 +02:00
Kyle Altendorf 4b36f9aa64 Tidy timeout checking 2018-10-05 16:46:24 -04:00
Kyle Altendorf ed5556bdac Add to docstrings 2018-10-05 10:02:59 -04:00
Kyle Altendorf 42422a7f62 Throw away arbitrary args to runpytest_subprocess() 2018-10-05 00:30:25 -04:00
Kyle Altendorf f3a173b736 Revert "Use signal.alarm() for py2 timeout"
This reverts commit 900cef6397.
2018-10-05 00:05:46 -04:00
Kyle Altendorf 5c38a5160d Slight diff tidy 2018-10-04 23:33:38 -04:00
Kyle Altendorf dcf9eb0104 Raise an exception on unexpected kwargs 2018-10-04 23:27:01 -04:00
Kyle Altendorf dd225e1b9d Tidy getting of timeout from kwargs 2018-10-04 23:15:30 -04:00
Kyle Altendorf 900cef6397 Use signal.alarm() for py2 timeout 2018-10-04 23:11:26 -04:00
Kyle Altendorf dcd635ba0c Correct timeout to check every so often 2018-10-04 23:08:57 -04:00
Kyle Altendorf 33f0338eeb kill and wait for subprocess before raising TimeoutExpired 2018-10-04 22:52:51 -04:00
Kyle Altendorf d5e5433553 Add descriptive message for timeout 2018-10-04 21:43:41 -04:00
Kyle Altendorf d2906950ce monotonic.monotonic() -> time.time() 2018-10-04 21:26:08 -04:00
Bruno Oliveira fe7050ba00 Fix lint 2018-10-04 18:45:30 -03:00
Bruno Oliveira a1208f5631
Merge pull request #4075 from nicoddemus/dynamic-fixturenames
Fix request.fixturenames to return fixtures created dynamically
2018-10-04 09:21:23 -03:00
Kyle Altendorf 870a93c37b
Actually construct TimeoutExpired 2018-10-04 01:02:58 -04:00
Kyle Altendorf 96b2ae6654 Initial pass at timeout for subprocessing pytest
pytest-dev/pytest#4073
2018-10-03 23:56:57 -04:00
Bruno Oliveira 212937eb3e Improve error message when TestCase functions use a parametrized fixture
Fix #2535
2018-10-03 19:43:46 -03:00
Bruno Oliveira 70c7273640 Fix request.fixturenames to return fixtures created dynamically
Fix #3057
2018-10-03 18:50:14 -03:00
Anthony Sottile e5ab62b1b6 Remove (unused) offset= parameter from deindent() 2018-10-03 13:33:10 -07:00
Anthony Sottile f102ccc8f0 Fix source reindenting by using `textwrap.dedent` directly. 2018-10-02 16:13:35 -07:00
Bruno Oliveira 1101a20408 Merge remote-tracking branch 'upstream/master' into merge-master-into-features 2018-10-02 18:13:54 -03:00
Bruno Oliveira 1a323fbd3c Show a warning when non-str is given to Monkeypatch.setenv 2018-10-01 20:07:07 -03:00
Bruno Oliveira 9d971d33be Hide internal pytest.warns traceback 2018-10-01 18:45:08 -03:00
Bruno Oliveira d24a7e6c5a Issue warning if Monkeypatch.setenv/delenv receive non-strings in Python 2
Fixes the bug described in:

	https://github.com/tox-dev/tox/pull/1025#discussion_r221273830

Which is more evident when using `unicode_literals`.
2018-10-01 17:05:30 -03:00
Ronny Pfannschmidt 5d2d64c190
Merge pull request #4057 from jeffreyrack/4051-improve-error-messaging
Improve error messaging when invalid syntax is passed to the -m option
2018-10-01 07:16:59 +02:00
Jeffrey Rackauckas c2179c3127 Improve error messaging when invalid syntax is passed to the -m option 2018-09-30 18:34:56 -07:00
Bruno Oliveira d8d7f73e1c
Merge pull request #4045 from nicoddemus/root-conftest-warning-workaround-4039
Do not issue non-top-level conftest warning when --pyargs is used
2018-09-27 09:26:11 -03:00
Ronny Pfannschmidt 3c23b5b010
Merge pull request #4037 from nicoddemus/deprecate-item-warnings-captured-hook
Document that item parameter of pytest_warning_captured hook is deprecated
2018-09-27 13:20:26 +02:00
Bruno Oliveira d2fc7ca6e0
Merge pull request #4041 from Zac-HD/user-properties-type
Ensure user_properties is a list
2018-09-27 08:04:30 -03:00
Bruno Oliveira 32c5a113e2 Do not issue non-top-level conftest warning when --pyargs is used
Fix #4039
2018-09-26 12:02:08 -03:00
Zac-HD a089a9577e Succinct definition of user_properties 2018-09-26 22:40:11 +10:00
Zac-HD 6be2136f20 Ensure user_properties is a list 2018-09-26 22:04:50 +10:00
Denis Otkidach f9ab81a493 Exclude empty reports for passed tests 2018-09-26 11:55:39 +03:00
Bruno Oliveira 1636522563 Document that item parameter of pytest_warning_captured hook is deprecated
Our policy is to not deprecate features during bugfix releases, but in this
case I believe it makes sense as we are only documenting it as deprecated,
without issuing warnings which might potentially break test suites.

This will get the word out that hook implementers should not use this parameter
at all.

Fix #4036
2018-09-25 17:38:22 -03:00
Anthony Sottile 956b3aca97 Revert patching of breakpointhook as it appears to do nothing 2018-09-23 18:39:50 -07:00
iwanb c61ff31ffa Fix #3539: reload module with assertion rewrite import hook 2018-09-23 13:05:55 +02:00
Ronny Pfannschmidt e03a19f88d
Merge pull request #4021 from nicoddemus/merge-master-into-features
Merge master into features
2018-09-23 11:57:05 +02:00
Bruno Oliveira 56d0b5a7e2 Merge remote-tracking branch 'upstream/master' into merge-master-into-features 2018-09-22 18:14:36 -03:00
Bruno Oliveira c30184709d Show deprecation warnings even if filters are customized
Fix #4013
2018-09-22 10:25:57 -03:00
Maximilian Albert 9b382ed16c Fix typo in docstring 2018-09-21 17:11:15 +01:00
Ronny Pfannschmidt f02dbaf97f
Merge pull request #4010 from nicoddemus/package-len-error-3749
Fix 'Package has no len()' error during collection
2018-09-21 07:40:20 +02:00
Bruno Oliveira 41f6ea13ce Fix 'Package has no len()' error during collection
Fix #3749
2018-09-20 17:53:21 -03:00
Ronny Pfannschmidt f6eb39df33
Merge pull request #4001 from asottile/fix_bytes_repr_text_mix_python_2
Fix UnicodeDecodeError in assertion with mixed non-ascii bytes repr + text
2018-09-20 22:16:37 +02:00
Anthony Sottile 7122fa5613 Fix UnicodeDecodeError in assertion with mixed non-ascii bytes repr + text 2018-09-19 20:24:00 -07:00
Bruno Oliveira 7aff81739e
Merge pull request #3998 from blueyed/logging-del
logging: del item.catch_log_handler only in teardown
2018-09-19 20:07:19 -03:00
Bruno Oliveira 27772f67c0
Merge pull request #3987 from nicoddemus/fix-find-scope-3941
Fix scope determination with indirect parameters
2018-09-19 20:06:45 -03:00
Daniel Hahler e7eb7e799b logging: del item.catch_log_handler only in teardown
Without this caplog.record_tuples etc is not available anymore when using
`--pdb`.
2018-09-19 17:17:47 +02:00
Thomas Hisch 18cc74b8d0 Remove useless comment 2018-09-19 15:18:37 +02:00
Bruno Oliveira 7f48f552c1
Fix linting 2018-09-19 10:18:05 -03:00
Bruno Oliveira 1e2e65f0fa
Add references to the relevant Python issues 2018-09-19 08:20:23 -03:00
Thomas Hisch e967d4587a Add support for logging in collection-phase
The logging plugin does not output log messages generated during the
collection-phase when live-logging is enabled. This fixes this.

Fixes #3964
2018-09-18 20:18:24 +02:00