File tree 5 files changed +40
-55
lines changed
5 files changed +40
-55
lines changed Original file line number Diff line number Diff line change 5
5
tests/*
6
6
prepare/*
7
7
*/_itertools.py
8
+ exercises.py
8
9
9
10
[report]
10
11
show_missing = True
Original file line number Diff line number Diff line change 24
24
- name : Run tests
25
25
run : tox
26
26
27
- benchmark :
28
- runs-on : ubuntu-latest
29
- steps :
30
- - uses : actions/checkout@v2
31
- - name : Setup Python
32
- uses : actions/setup-python@v2
33
- with :
34
- python-version : 3.9
35
- - name : Install tox
36
- run : |
37
- python -m pip install tox
38
- - name : Run benchmarks
39
- run : tox
40
- env :
41
- TOXENV : perf{,-ref}
42
-
43
27
diffcov :
44
28
runs-on : ubuntu-latest
45
29
steps :
Original file line number Diff line number Diff line change
1
+ from pytest_perf .deco import extras
2
+
3
+
4
+ @extras ('perf' )
5
+ def discovery_perf ():
6
+ "discovery"
7
+ import importlib_metadata # end warmup
8
+
9
+ importlib_metadata .distribution ('ipython' )
10
+
11
+
12
+ def entry_points_perf ():
13
+ "entry_points()"
14
+ import importlib_metadata # end warmup
15
+
16
+ importlib_metadata .entry_points ()
17
+
18
+
19
+ @extras ('perf' )
20
+ def cached_distribution_perf ():
21
+ "cached distribution"
22
+ import importlib_metadata
23
+
24
+ importlib_metadata .distribution ('ipython' ) # end warmup
25
+ importlib_metadata .distribution ('ipython' )
26
+
27
+
28
+ @extras ('perf' )
29
+ def uncached_distribution_perf ():
30
+ "uncached distribution"
31
+ import importlib
32
+ import importlib_metadata
33
+
34
+ # end warmup
35
+ importlib .invalidate_caches ()
36
+ importlib_metadata .distribution ('ipython' )
Original file line number Diff line number Diff line change @@ -51,6 +51,7 @@ testing =
51
51
pep517
52
52
pyfakefs
53
53
flufl.flake8
54
+ pytest-perf >= 0.9.2
54
55
55
56
docs =
56
57
# upstream
Original file line number Diff line number Diff line change @@ -10,6 +10,8 @@ toxworkdir={env:TOX_WORK_DIR:.tox}
10
10
deps =
11
11
commands =
12
12
pytest {posargs}
13
+ passenv =
14
+ HOME
13
15
usedevelop = True
14
16
extras = testing
15
17
setenv =
@@ -33,45 +35,6 @@ commands =
33
35
diff-cover coverage.xml --compare-branch =origin/main --html-report diffcov.html
34
36
diff-cover coverage.xml --compare-branch =origin/main --fail-under =100
35
37
36
- [perf]
37
- deps =
38
- ipython
39
- pyperf
40
- path
41
- commands =
42
- python -c " import path; path.Path('{env:SCOPE}.json').remove_p()"
43
-
44
- python -m pyperf timeit --name discovery --append {env:SCOPE}.json -s ' import importlib_metadata' ' importlib_metadata.distribution("ipython")'
45
-
46
- python -m pyperf timeit --name ' entry_points()' --append {env:SCOPE}.json -s ' import importlib_metadata' ' importlib_metadata.entry_points()'
47
-
48
- python -m pyperf timeit --name ' cached distribution' --append {env:SCOPE}.json -s ' import importlib_metadata; importlib_metadata.distribution("ipython")' ' importlib_metadata.distribution("ipython")'
49
-
50
- python -m pyperf timeit --name ' uncached distribution' --append {env:SCOPE}.json -s ' import importlib, importlib_metadata' ' importlib.invalidate_caches(); importlib_metadata.distribution("ipython")'
51
-
52
- [testenv:perf]
53
- use_develop = False
54
- # change dir to avoid picking up local package.
55
- changedir = {toxworkdir}
56
- setenv =
57
- SCOPE = local
58
- deps = {[perf]deps}
59
- commands = {[perf]commands}
60
-
61
- [testenv:perf-ref]
62
- # compare perf results to the main branch
63
- skip_install = True
64
- # change dir to avoid picking up local package.
65
- changedir = {toxworkdir}
66
- setenv =
67
- SCOPE = main
68
- deps =
69
- {[perf]deps}
70
- git+https://github.com/python/importlib_metadata
71
- commands =
72
- {[perf]commands}
73
- python -m pyperf compare_to --verbose main.json local.json --table
74
-
75
38
[testenv:release]
76
39
skip_install = True
77
40
deps =
You can’t perform that action at this time.
0 commit comments