diff options
author | Ran Benita <ran@unusedvar.com> | 2020-05-11 11:50:41 +0300 |
---|---|---|
committer | Ran Benita <ran@unusedvar.com> | 2020-05-12 12:55:37 +0300 |
commit | c714f05ad707fae11804e34cf38bf5ba0fbf0b88 (patch) | |
tree | f455259e9bd03933c43c0096f251a402d042fbeb /testing/test_pytester.py | |
parent | 622c4ce02efb543027932d3d39c8db8b7fefe337 (diff) | |
download | pytest-c714f05ad707fae11804e34cf38bf5ba0fbf0b88.tar.gz |
mark: reuse compiled expression for all items in -k/-m
The previous commit made this possible, so utilize it.
Since legacy.py becomes pretty bare, I inlined it into __init__.py. I'm
not sure it's really "legacy" anyway!
Using a simple 50000 items benchmark with `--collect-only -k nomatch`:
Before (two commits ago):
======================== 50000 deselected in 10.31s =====================
19129345 function calls (18275596 primitive calls) in 10.634 seconds
Ordered by: cumulative time
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.001 0.001 2.270 2.270 __init__.py:149(pytest_collection_modifyitems)
1 0.036 0.036 2.270 2.270 __init__.py:104(deselect_by_keyword)
50000 0.055 0.000 2.226 0.000 legacy.py:87(matchkeyword)
After:
======================== 50000 deselected in 9.37s =========================
18029363 function calls (17175972 primitive calls) in 9.701 seconds
Ordered by: cumulative time
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 1.394 1.394 __init__.py:239(pytest_collection_modifyitems)
1 0.057 0.057 1.393 1.393 __init__.py:162(deselect_by_keyword)
The matching itself can be optimized more but that's a different story.
Diffstat (limited to 'testing/test_pytester.py')
-rw-r--r-- | testing/test_pytester.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/testing/test_pytester.py b/testing/test_pytester.py index fa0cfce97..1d3321455 100644 --- a/testing/test_pytester.py +++ b/testing/test_pytester.py @@ -443,7 +443,7 @@ def test_testdir_subprocess_via_runpytest_arg(testdir) -> None: def test_unicode_args(testdir) -> None: - result = testdir.runpytest("-k", "💩") + result = testdir.runpytest("-k", "אבג") assert result.ret == ExitCode.NO_TESTS_COLLECTED |