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
Bruno Oliveira
0f5263cdc3
Merge pull request #4109 from njonesu/master
...
Fix multiple string literals on a line #4093
2018-10-11 15:50:08 -03:00
Ronny Pfannschmidt
b82d6f7a0b
pytester: use per test tmproot
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
00716177b4
fix missed Path import
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
d76fa59b35
fix lock timeouts for good this time
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
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
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
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
Daniel Hahler
be511c1a05
tests: add missing expect before sendeof for pdbpp
...
With pdb++ this additional `expect` is required, otherwise `sendeof()`
will block forever.
2018-10-10 20:50:49 +02:00
Daniel Hahler
f36f9d2698
tests: fix/clarify expect for Pdb
...
`expect()` expects an regular expression, so "Pdb" is equivalent to
"(Pdb)".
But instead of escaping the parenthesis this patch removes them, to
allow for matching "(Pdb++)", too.
2018-10-10 20:50:49 +02:00
Niklas JQ
c14a23d4e4
Fix #4093 : multiple string literals on a line
2018-10-10 19:28:31 +02:00
Anthony Sottile
e0f6fce9e9
In python2, display previously warned warnings
2018-10-10 09:37:21 -07: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
Ronny Pfannschmidt
8393fdd51d
Merge pull request #4089 from asottile/upgrade_hooks
...
Upgrade pre-commit hooks
2018-10-09 07:43:28 +02:00
Kyle Altendorf
4071c8a4a8
Correct timing in test_pytester.test_testdir_run_with_timeout()
2018-10-08 21:03:42 -04:00
Anthony Sottile
a86035625c
Increase recursion limit (broke xdist tests)
2018-10-08 12:57:45 -07:00
Anthony Sottile
4f631440be
Use RuntimeError for py27 + py34 compat
2018-10-08 11:47:06 -07:00
Anthony Sottile
3901569f26
Improve performance of ~3 of the slowest tests
2018-10-08 11:12:55 -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
48dcc67274
Increase timeout in test_testdir_run_with_timeout to decrease false failures
2018-10-06 22:02:33 -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
8e0e862c84
Stretch out the time assertion for slow AppVeyor
2018-10-05 01:38:01 -04:00
Kyle Altendorf
0d095fc978
Up timeout to 1 second for test
2018-10-04 23:09:07 -04:00
Kyle Altendorf
dcd635ba0c
Correct timeout to check every so often
2018-10-04 23:08:57 -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
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
b8b9e8d41c
Remove duplicate test (tested above)
2018-10-03 10:01:06 -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
bc009a8582
Fix test to comply with pypy 6.0
2018-10-01 18:37:27 -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
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
Bruno Oliveira
ba5630e0f8
Simplify test_pytest_plugins_in_non_top_level_conftest_deprecated
2018-09-26 10:49:14 -03:00
Denis Otkidach
808df48ee8
Test for excluding empty reports for passed tests
2018-09-26 16:44:00 +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
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
048342817b
Add testcase for logging to file
2018-09-18 21:47:42 +02: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
Bruno Oliveira
a79dc12f1e
Merge pull request #3970 from sambarluc/raise_on_empty_parameterset
...
Raise exception if parametrize collects an empty parameter set
2018-09-18 08:11:34 -03:00
Bruno Oliveira
37d2469266
Use a PurePath instance to do matching against patterns in assertion rewrite
...
This way we don't need to have real file system path, which prevents the
original #3973 bug.
2018-09-17 20:29:09 -03:00
Bruno Oliveira
1df6d28080
Fix assertion rewriter crash if cwd changes mid-testing
...
Unfortunately we need to get a `py.path.local` object to perform the fnmatch
operation, it is different from the standard `fnmatch` module because it
implements its own custom logic. So we need to use `py.path` to perform
the fnmatch for backward compatibility reasons.
Ideally we should be able to use a "pure path" in `pathlib` terms (a path
not bound to the file system), but we don't have those in pylib.
Fix #3973
2018-09-17 20:04:44 -03:00
Andrea Cimatoribus
05155e4db0
Fail at parametrize option for empty parameter set
...
Optionally raise an exception when parametrize collects no arguments.
Provide the name of the test causing the failure in the exception
message.
See: #3849
2018-09-15 09:18:03 +02:00
Bruno Oliveira
86a14d007d
Fix scope determination with indirect parameters
...
Fix #3941
2018-09-14 21:33:59 -03:00
Bruno Oliveira
87ddb2dbd5
Change flaky test_request_garbage to provide more debug information
...
This test fails *very* rarely when running in xdist.
2018-09-14 15:25:45 -03:00
Bruno Oliveira
9aa6b0903b
.pytest_cache is now automatically ignored by Git
2018-09-14 15:16:40 -03:00
Bruno Oliveira
feb8240410
Use self.Function again during collection
2018-09-13 15:44:02 -03:00
Bruno Oliveira
b7dd9154c3
Deprecate custom node types during collection by using special names
2018-09-13 14:55:28 -03:00
Bruno Oliveira
482bd5efd2
Show deprecation warning for cached_setup
2018-09-13 14:25:46 -03:00
Bruno Oliveira
bf074b37a3
Show deprecation warnings for compat properties
...
Fix #3616
2018-09-13 14:10:30 -03:00
Ronny Pfannschmidt
a0ce9a4441
remove the legacy code about im_func and generalize using fix and compat.getimfunc
2018-09-13 15:38:36 +02:00
Daniel Hahler
7537e94ddf
tests: use unittest.mock with py34+
...
Fixes https://github.com/pytest-dev/pytest/issues/3965 .
Has to work around https://github.com/tox-dev/tox/issues/706 .
No coverage for pluggymaster builds is OK though anyway.
2018-09-12 23:21:47 +02:00
Bruno Oliveira
ab40696007
-W now takes precedence over filters in ini files
...
Fix #3946
2018-09-11 19:00:42 +02:00
Bruno Oliveira
c00d934b21
Merge pull request #3933 from nicoddemus/idval-hypothesis-flaky-3707
...
Use -n auto now that xdist behaves well in Travis and AppVeyor
2018-09-06 15:15:55 -03:00
Bruno Oliveira
5eb85efa14
Use -n auto now that xdist behaves well in Travis and AppVeyor
...
This hopefully fixes the flaky test_idval_hypothesis on AppVeyor
Fix #3707
2018-09-06 09:22:13 -03:00
Bruno Oliveira
69b34f7658
Merge remote-tracking branch 'upstream/master' into release-3.8.0
2018-09-05 18:02:02 -03:00
Bruno Oliveira
531b76a513
Merge pull request #3931 from nicoddemus/internal-warnings
...
Use standard warnings for internal pytest warnings
2018-09-05 14:05:52 -03:00
Bruno Oliveira
f63c683faa
No longer escape regex in pytest.mark.filterwarnings
...
Fix #3936
2018-09-05 10:20:25 -03:00
Bruno Oliveira
ddb308455a
Make sure warn is called in test_parameterset_extractfrom
2018-09-05 09:01:29 -03:00
Bruno Oliveira
adc9ed85bc
Fix test_idval_hypothesis
2018-09-04 18:49:20 -03:00
Bruno Oliveira
4592def14d
Improve test_rewarn_functional
2018-09-04 17:02:56 -03:00
Bruno Oliveira
2e0a7cf78d
Revert to having just "runtest" as "when" parameter of the pytest_warning_captured hook
2018-09-04 17:01:23 -03:00
Bruno Oliveira
5a52acaa92
Make config no longer optional in parametrize id functions
2018-09-04 16:55:52 -03:00
Bruno Oliveira
b7560a8808
Keep backward compatibility for code as kw in Node.warn
2018-09-04 16:48:21 -03:00
Bruno Oliveira
d3ca739c00
Use explicit instances when calling warnings.warn_explicit
2018-09-04 16:29:48 -03:00
Bruno Oliveira
438f7a1254
Add "setup", "call" and "teardown" values to "when" parameter of pytest_warning_captured hook
2018-09-04 15:53:17 -03:00
Bruno Oliveira
47bf58d69e
Make Node.warn support two forms, new and deprecated
...
As suggested during review, it now accepts two forms:
Node.warn(warning_instance) (recommended)
Node.warn(code, message) (deprecated)
2018-09-04 15:53:17 -03:00
Bruno Oliveira
5ef51262f7
Fix reference to PytestWarning in warningsfilter mark
2018-09-04 15:06:14 -03:00
Bruno Oliveira
f1cfd10c94
Handle cache warnings in tests
2018-09-04 14:44:02 -03:00
Bruno Oliveira
b42518acd5
Change std_warn to receive a single warning instance, addressed review suggestions
2018-09-04 14:20:42 -03:00
Bruno Oliveira
9ae0a3cd85
Do not trigger warning about tuples being always True if the tuple has size != 2
2018-09-04 13:41:11 -03:00
Bruno Oliveira
56d414177a
Remove nodeid from messages for warnings generated by standard warnings
...
Standard warnings already contain the proper location, so we don't need
to also print the node id
2018-09-04 11:35:34 -03:00
Bruno Oliveira
0fffa6ba2f
Implement hack to issue warnings during config
...
Once we can capture warnings during the config stage, we can
then get rid of this function
Related to #2891
2018-09-04 11:35:34 -03:00
Bruno Oliveira
60499d221e
Add test to ensure that users can suppress internal warnings
2018-09-04 11:35:34 -03:00
Bruno Oliveira
9965ed84da
Show deprecation warnings by default if no other filters are configured
...
Fix #2908
2018-09-04 11:35:34 -03:00