Daniel Hahler
d530d70128
Fix regressions with `--lf` plugin
...
Only filter with known failures, and explicitly keep paths of passed
arguments.
This also displays the "run-last-failure" status before collected files,
and does not update the cache with "--collect-only".
Fixes https://github.com/pytest-dev/pytest/issues/6968 .
2020-05-15 18:35:38 -03:00
Ran Benita
e5d6e58625
Merge pull request #7130 from bluetech/cacheprovider-nf-set
...
cacheprovider: speed up NFPlugin when --nf is not enabled
2020-04-29 17:28:20 +03:00
Ran Benita
4a42afdc2f
cacheprovider: speed up NFPlugin when --nf is not enabled
...
The code used an O(n^2) loop. Replace list with set to make it O(n).
For backward compatibility the filesystem cache still remains a list.
On this test:
import pytest
@pytest.mark.parametrize("x", range(5000))
def test_foo(x): pass
run with `pytest --collect-only`:
Before: 0m1.251s
After: 0m0.921s
2020-04-29 13:02:38 +03:00
Ran Benita
49e50d3106
testing: fix warning issued by test_cache_writefail_cachfile_silent
...
Remove this message which was shown in the warning summary of pytest's
own testsuite:
testing/test_cacheprovider.py::TestNewAPI::test_cache_writefail_cachfile_silent
testing/test_cacheprovider.py:40: PytestCacheWarning: could not create cache path /tmp/pytest-of-ran/pytest-2/test_cache_writefail_cachfile_silent0/.pytest_cache/v/test/broken
cache.set("test/broken", [])
2020-04-28 22:49:00 +03:00
Daniel Hahler
1b30514783
LFPlugin: use sub-plugins to deselect during collection ( #6448 )
...
Fixes https://github.com/pytest-dev/pytest/issues/5301 .
Refactor/steps:
- use var
- harden test_lastfailed_usecase
- harden test_failedfirst_order
- revisit last_failed_paths
- harden test_lastfailed_with_known_failures_not_being_selected
2020-02-19 21:33:03 +01:00
Daniel Hahler
442f7a7706
Do not use fixed line number with test_cache_failure_warns ( #6748 )
...
It was not previously checking for the line number also (02aa8ad
), and this is
obviously wrong (affected by changes to the file).
2020-02-18 09:27:33 +01:00
Daniel Hahler
2b5adc88a7
Move test_issue4445_cacheprovider_set into test_cache_failure_warns
...
Would need to be adjusted anyway non-trivially, and we can just harden
`test_cache_failure_warns` instead.
2020-02-15 02:01:22 +01:00
Daniel Hahler
02aa8adae1
cacheprovider: use warnings directly
...
Allows for filtering of PytestCacheWarning.
Using `_issue_warning_captured` is not necessary here, and was probably
only used because the cacheprovider misses warnings during
`pytest_sessionfinish`, which is also fixed here.
I think the usage of `_issue_warning_captured` can be removed/reduced
further, but also that this is good enough for now.
Ref: https://github.com/pytest-dev/pytest/issues/6681 .
2020-02-15 01:36:57 +01:00
Ran Benita
d33da078a8
Move ExitCode's definition from _pytest.main to _pytest.config
...
ExitCode is used in several internal modules and hooks and so with type
annotations added, needs to be imported a lot.
_pytest.main, being the entry point, generally sits at the top of the
import tree.
So, it's not great to have ExitCode defined in _pytest.main, because it
will cause a lot of import cycles once type annotations are added (in
fact there is already one, which this change removes).
Move it to _pytest.config instead.
_pytest.main still imports ExitCode, so importing from there still
works, although external users should really be importing from `pytest`.
2020-02-10 23:55:06 +02:00
Daniel Hahler
09bdbffbde
Merge master into features
...
Conflicts:
src/_pytest/_code/code.py
src/_pytest/main.py
2020-01-24 23:44:50 +01:00
Daniel Hahler
e7444bbd5e
tests: remove unnecessary `-rw` option
...
Warnings are enabled by default, which is tested by `test_getreportopt`.
2020-01-23 11:37:19 +01:00
Bruno Oliveira
93b74d28d2
Merge remote-tracking branch 'upstream/master' into mm
...
Conflicts:
* src/_pytest/_code/code.py
* src/_pytest/main.py
* testing/python/metafunc.py
* testing/test_parseopt.py
* testing/test_pytester.py
2020-01-22 11:03:45 -03:00
Daniel Hahler
8f5fd537d8
--cache-clear: add test for keeping non-supporting files
...
Ref: https://github.com/pytest-dev/pytest/pull/6296
2020-01-21 22:16:56 +01:00
Daniel Hahler
2d2c67d7c0
cacheprovider: pytest_collection_modifyitems: copy items
2020-01-09 21:48:54 +01:00
Bruno Oliveira
172b82875a
Ensure cache supporting files still exist after --cache-clear
...
Fix #6290
2019-12-01 10:36:47 -03:00
Daniel Hahler
b9a3ba1fe8
test_cache_writefail_permissions: ignore any other plugins
2019-11-16 23:29:24 +01:00
Daniel Hahler
1b4623a6d1
tests: revisit test_cacheprovider
2019-11-16 23:29:24 +01:00
Daniel Hahler
1abb08d52f
tests: use sys.dont_write_bytecode
...
Setting PYTHONDONTWRITEBYTECODE in the environment does not change it
for the current process.
2019-11-15 23:13:08 +01:00
Daniel Hahler
d8096925fa
Fix for Python 3.5 not handling LocalPath
2019-11-06 00:22:46 +01:00
Daniel Hahler
9309ae299a
Use try/finally to ensure chmod is run, filter warning
2019-11-05 22:28:32 +01:00
Tibor Arpas
262ed567d0
tests: clean up chmod-related tests to fix rm_rf warnings
...
Fixed https://github.com/pytest-dev/pytest/issues/5974#issuecomment-549822509 .
2019-11-05 22:10:27 +01:00
Bruno Oliveira
fb0e8b99d1
Merge remote-tracking branch 'upstream/master' into mm
...
Conflicts:
- src/_pytest/cacheprovider.py
2019-10-24 21:13:43 -03:00
Daniel Hahler
82e9013e73
Merge pull request #6004 from blueyed/fix-nf
...
cache: NFPlugin: keep known nodeids
2019-10-23 01:04:48 +02:00
Daniel Hahler
803cc1f294
Merge master into features
2019-10-21 00:08:03 +02:00
Anthony Sottile
3a402811de
Ensure .pytest_cache file has a newline at the end
2019-10-19 14:42:06 -07:00
Daniel Hahler
3173a26388
cache: NFPlugin: keep known nodeids
...
Caveat: does not forget about old nodeids
Fixes https://github.com/pytest-dev/pytest/issues/5206
2019-10-19 04:53:01 +02:00
Bruno Oliveira
47c2091ecd
Use new no-match functions to replace previous idiom
2019-10-06 18:05:24 -03:00
Ronny Pfannschmidt
2b92fee1c3
initial conversion of exit codes to enum
2019-06-15 06:48:00 +02:00
Anthony Sottile
a91fe1fedd
pre-commit run pyupgrade --all-files
2019-06-03 12:08:02 -03:00
Anthony Sottile
3f1ec520fc
pre-commit run reorder-python-imports --all-files
2019-06-03 12:08:01 -03:00
Anthony Sottile
5034399d7a
pre-commit run fix-encoding-pragma --all-files
2019-06-03 12:08:01 -03:00
Daniel Hahler
ff80464b47
last-failed: display skipped-files msg always
2019-05-29 23:32:52 +02:00
Daniel Hahler
ceb4f3f701
fixup! Fix regression with --lf and non-selected failures
2019-05-29 23:24:52 +02:00
Daniel Hahler
bf3b26b3f7
Fix regression with --lf and non-selected failures
2019-05-29 22:44:43 +02:00
Anthony Sottile
dc75b6af47
Use fix-encoding-pragma pre-commit hook
2019-05-14 15:56:31 -07:00
Bruno Oliveira
08734bdd18
--lf now skips colletion of files without failed tests
...
Fix #5172
2019-04-28 20:23:46 -03:00
Daniel Hahler
eb5b2e0db5
Support glob argument with ``--cache-show``
2019-04-04 18:10:39 +02:00
Daniel Hahler
1f5a61e4ef
run-last-failure: improve reporting
2019-04-03 16:27:12 +02:00
Daniel Hahler
4148663706
Merge pull request #4979 from blueyed/minor
...
Minor: whitespace, typo, docs
2019-03-26 10:01:13 +01:00
Daniel Hahler
08f3b02dfc
tests: fnmatch_lines: use list
...
For strings fnmatch_lines converts it into a Source objects, splitted on
newlines. This is not necessary here, and it is more consistent to use
lists here in the first place.
2019-03-23 11:36:18 +01:00
Daniel Hahler
ade773390a
minor: rename inner test
2019-03-22 13:23:44 +01:00
Kristoffer Nordstroem
6d38868950
fix tests by adding additional output to expected responses
2019-01-24 00:08:43 +01:00
feuillemorte
d237197de3
#4278 Added a CACHEDIR.TAG file to the cache directory
2018-12-04 13:49:08 +01:00
Bruno Oliveira
c5c728c8bc
Fix test/improve tests a bit in py27
2018-11-22 21:38:33 -02:00
Daniel Hahler
0385c27343
cacheprovider: do not write README/.gitignore to existing dir
...
Fixes https://github.com/pytest-dev/pytest/issues/4393 .
2018-11-14 22:09:09 +01:00
Daniel Hahler
a6a96469ca
pytester: pop TOX_ENV_DIR from os.environ
...
Closes: https://github.com/pytest-dev/pytest/pull/4378
Fixes: https://github.com/pytest-dev/pytest/issues/4366
2018-11-13 09:02:52 +01:00
Daniel Hahler
a507f44465
cache_dir: use $TOX_ENV_DIR/ prefix if set
...
Fixes https://github.com/pytest-dev/pytest/issues/4270
2018-11-09 05:29:28 +01:00
Ronny Pfannschmidt
9fe871016d
Merge pull request #4147 from davidszotten/stepwise
...
Stepwise
2018-10-27 15:05:05 +02:00
Anthony Sottile
2368fbb63c
Apply reorder-python-imports to all files
2018-10-25 00:01:29 -07:00
David Szotten
c25310d34f
fix cacheprovider test
2018-10-15 21:51:15 +01:00