Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve performance of ~3 of the slowest tests #4090

Merged
merged 3 commits into from
Oct 9, 2018
Merged

Improve performance of ~3 of the slowest tests #4090

merged 3 commits into from
Oct 9, 2018

Conversation

asottile
Copy link
Member

@asottile asottile commented Oct 8, 2018

cherry picked a few from pytest testing/{subdir} --durations=5 and wanted to see what I could do to make them faster.

this saves ~11 seconds off of a test run (which isn't much but it's something!)

interesting to note that runpytest_subprocess adds about 500ms per invocation. (I guess we should avoid it if possible? @nicoddemus do you know if there's a reason why it was used for #3124?)

@nicoddemus
Copy link
Member

@nicoddemus do you know if there's a reason why it was used for #3124?

I don't recall why, and looking at the test itself no clear reason jumps to me... if things are passing, I say let's keep your changes. 😁

@@ -1361,40 +1371,30 @@ def a(x):
def b(x):
return a(numpy_like())

try:
with pytest.raises(RecursionError) as excinfo:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RecursionError is py35+ (or py36+) only; IIRC you need to use RuntimeError instead.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dang, I always forget this 😭

@codecov
Copy link

codecov bot commented Oct 8, 2018

Codecov Report

Merging #4090 into master will decrease coverage by 0.07%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #4090      +/-   ##
=========================================
- Coverage   94.47%   94.4%   -0.08%     
=========================================
  Files         109     109              
  Lines       23813   23811       -2     
  Branches     2349    2349              
=========================================
- Hits        22498   22478      -20     
- Misses       1007    1021      +14     
- Partials      308     312       +4
Flag Coverage Δ
#doctesting 28.48% <ø> (+0.06%) ⬆️
#linux 94.4% <100%> (+0.04%) ⬆️
#nobyte 0% <ø> (ø) ⬆️
#numpy 28.08% <ø> (+0.06%) ⬆️
#pexpect 0% <ø> (ø) ⬆️
#py27 92.56% <100%> (-0.07%) ⬇️
#py34 92% <100%> (-0.09%) ⬇️
#py35 92.01% <100%> (-0.09%) ⬇️
#py36 92.53% <100%> (+0.03%) ⬆️
#py37 92.17% <100%> (+0.03%) ⬆️
#trial 31.16% <ø> (+0.06%) ⬆️
#windows ?
#xdist 18.1% <ø> (-0.4%) ⬇️
Impacted Files Coverage Δ
testing/logging/test_fixture.py 100% <100%> (ø) ⬆️
testing/code/test_excinfo.py 96.74% <100%> (+0.1%) ⬆️
testing/test_paths.py 86.36% <0%> (-13.64%) ⬇️
src/_pytest/paths.py 91.3% <0%> (-8.7%) ⬇️
testing/test_tmpdir.py 95.06% <0%> (-4.94%) ⬇️
src/_pytest/capture.py 86.72% <0%> (-1.84%) ⬇️
src/_pytest/nodes.py 93.69% <0%> (-0.85%) ⬇️
testing/acceptance_test.py 97.14% <0%> (-0.66%) ⬇️
src/_pytest/pytester.py 85.56% <0%> (-0.46%) ⬇️
testing/test_capture.py 98.94% <0%> (-0.31%) ⬇️
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 689b856...a860356. Read the comment docs.

@nicoddemus
Copy link
Member

Noice! 👍

Copy link
Member

@RonnyPfannschmidt RonnyPfannschmidt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fabulous enhancements 👍

@coveralls
Copy link

coveralls commented Oct 8, 2018

Coverage Status

Coverage increased (+0.02%) to 93.813% when pulling a860356 on asottile:faster_tests into 689b856 on pytest-dev:master.

@asottile asottile merged commit e8c10d4 into pytest-dev:master Oct 9, 2018
@asottile asottile deleted the faster_tests branch October 9, 2018 00:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants