Skip to content

Commit 4024ef4

Browse files
committed
docs: more details, and current output, in contributing.rst
1 parent 402858f commit 4024ef4

File tree

1 file changed

+78
-43
lines changed

1 file changed

+78
-43
lines changed

doc/contributing.rst

Lines changed: 78 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -67,57 +67,91 @@ Running the tests
6767
The tests are written mostly as standard unittest-style tests, and are run with
6868
pytest running under `tox`_::
6969

70-
$ tox
71-
py37 create: /Users/nedbat/coverage/trunk/.tox/py37
72-
py37 installdeps: -rrequirements/pip.pip, -rrequirements/pytest.pip, eventlet==0.25.1, greenlet==0.4.15
73-
py37 develop-inst: /Users/nedbat/coverage/trunk
74-
py37 installed: apipkg==1.5,appdirs==1.4.4,attrs==20.3.0,backports.functools-lru-cache==1.6.4,-e [email protected]:nedbat/coveragepy.git@36ef0e03c0439159c2245d38de70734fa08cddb4#egg=coverage,decorator==5.0.7,distlib==0.3.1,dnspython==2.1.0,eventlet==0.25.1,execnet==1.8.0,filelock==3.0.12,flaky==3.7.0,future==0.18.2,greenlet==0.4.15,hypothesis==6.10.1,importlib-metadata==4.0.1,iniconfig==1.1.1,monotonic==1.6,packaging==20.9,pluggy==0.13.1,py==1.10.0,PyContracts @ git+https://github.com/slorg1/contracts@c5a6da27d4dc9985f68e574d20d86000880919c3,pyparsing==2.4.7,pytest==6.2.3,pytest-forked==1.3.0,pytest-xdist==2.2.1,qualname==0.1.0,six==1.15.0,sortedcontainers==2.3.0,toml==0.10.2,typing-extensions==3.10.0.0,virtualenv==20.4.4,zipp==3.4.1
75-
py37 run-test-pre: PYTHONHASHSEED='376882681'
76-
py37 run-test: commands[0] | python setup.py --quiet clean develop
77-
py37 run-test: commands[1] | python igor.py zip_mods remove_extension
78-
py37 run-test: commands[2] | python igor.py test_with_tracer py
79-
=== CPython 3.7.10 with Python tracer (.tox/py37/bin/python) ===
70+
% tox
71+
ROOT: tox-gh won't override envlist because tox is not running in GitHub Actions
72+
.pkg: _optional_hooks> python /usr/local/virtualenvs/coverage/lib/python3.7/site-packages/pyproject_api/_backend.py True setuptools.build_meta
73+
.pkg: get_requires_for_build_editable> python /usr/local/virtualenvs/coverage/lib/python3.7/site-packages/pyproject_api/_backend.py True setuptools.build_meta
74+
.pkg: build_editable> python /usr/local/virtualenvs/coverage/lib/python3.7/site-packages/pyproject_api/_backend.py True setuptools.build_meta
75+
py37: install_package> python -m pip install -U --force-reinstall --no-deps .tox/.tmp/package/87/coverage-7.2.3a0.dev1-0.editable-cp37-cp37m-macosx_10_15_x86_64.whl
76+
py37: commands[0]> python igor.py zip_mods
77+
py37: commands[1]> python setup.py --quiet build_ext --inplace
78+
py37: commands[2]> python -m pip install -q -e .
79+
py37: commands[3]> python igor.py test_with_tracer c
80+
=== CPython 3.7.15 with C tracer (.tox/py37/bin/python) ===
8081
bringing up nodes...
81-
........................................................................................................................................................... [ 15%]
82-
........................................................................................................................................................... [ 31%]
83-
...........................................................................................................................................s............... [ 47%]
84-
...........................................s...................................................................................sss.sssssssssssssssssss..... [ 63%]
85-
........................................................................................................................................................s.. [ 79%]
86-
......................................s..................................s................................................................................. [ 95%]
87-
........................................ss...... [100%]
88-
949 passed, 29 skipped in 40.56s
89-
py37 run-test: commands[3] | python setup.py --quiet build_ext --inplace
90-
py37 run-test: commands[4] | python igor.py test_with_tracer c
91-
=== CPython 3.7.10 with C tracer (.tox/py37/bin/python) ===
82+
.........................................................................................................................x.................s....s....... [ 11%]
83+
..s.....x.............................................s................................................................................................. [ 22%]
84+
........................................................................................................................................................ [ 34%]
85+
........................................................................................................................................................ [ 45%]
86+
........................................................................................................................................................ [ 57%]
87+
.........s....................................................................................................................s......................... [ 68%]
88+
.................................s..............................s...............s..................................s.................................... [ 80%]
89+
........................................................s............................................................................................... [ 91%]
90+
......................................s......................................................................... [100%]
91+
1316 passed, 12 skipped, 2 xfailed in 36.42s
92+
py37: commands[4]> python igor.py remove_extension
93+
py37: commands[5]> python igor.py test_with_tracer py
94+
=== CPython 3.7.15 with Python tracer (.tox/py37/bin/python) ===
9295
bringing up nodes...
93-
........................................................................................................................................................... [ 15%]
94-
........................................................................................................................................................... [ 31%]
95-
......................................................................s.................................................................................... [ 47%]
96-
........................................................................................................................................................... [ 63%]
97-
..........................s................................................s............................................................................... [ 79%]
98-
.................................................................................s......................................................................... [ 95%]
99-
......................................s......... [100%]
100-
973 passed, 5 skipped in 41.36s
101-
____________________________________________________________________________ summary _____________________________________________________________________________
102-
py37: commands succeeded
103-
congratulations :)
96+
................................................................................................x...........................x.................s......... [ 11%]
97+
.....s.............s.s.....................................................s..............ss............................s.ss....ss.ss................... [ 22%]
98+
......................................................................................................................................s................. [ 34%]
99+
..................................................................................................................s..................................... [ 45%]
100+
...................s.ss.....................................................................................s....................s.ss................... [ 57%]
101+
..................s.s................................................................................................................................... [ 68%]
102+
..........................s.........................................ssss...............s.................s...sss..................s...ss...ssss.s....... [ 80%]
103+
.......................................................................................................................................................s [ 91%]
104+
.........................................................................s.................................ss.... [100%]
105+
1281 passed, 47 skipped, 2 xfailed in 33.86s
106+
.pkg: _exit> python /usr/local/virtualenvs/coverage/lib/python3.7/site-packages/pyproject_api/_backend.py True setuptools.build_meta
107+
py37: OK (82.38=setup[2.80]+cmd[0.20,0.35,7.30,37.20,0.21,34.32] seconds)
108+
congratulations :) (83.61 seconds)
104109

105110
Tox runs the complete test suite twice for each version of Python you have
106-
installed. The first run uses the Python implementation of the trace function,
107-
the second uses the C implementation.
111+
installed. The first run uses the C implementation of the trace function,
112+
the second uses the Python implementation.
108113

109114
To limit tox to just a few versions of Python, use the ``-e`` switch::
110115

111116
$ tox -e py37,py39
112117

113-
To run just a few tests, you can use `pytest test selectors`_::
114-
115-
$ tox tests/test_misc.py
116-
$ tox tests/test_misc.py::HasherTest
117-
$ tox tests/test_misc.py::HasherTest::test_string_hashing
118-
119-
These command run the tests in one file, one class, and just one test,
120-
respectively.
118+
On the tox command line, options after ``--`` are passed to pytest. To run
119+
just a few tests, you can use `pytest test selectors`_::
120+
121+
$ tox -- tests/test_misc.py
122+
$ tox -- tests/test_misc.py::HasherTest
123+
$ tox -- tests/test_misc.py::HasherTest::test_string_hashing
124+
125+
These commands run the tests in one file, one class, and just one test,
126+
respectively. The pytest ``-k`` option selects tests based on a word in their
127+
name, which can be very convenient for ad-hoc test selection. Of course you
128+
can combine tox and pytest options::
129+
130+
$ tox -q -e py37 -- -n 0 -vv -k hash
131+
=== CPython 3.7.15 with C tracer (.tox/py37/bin/python) ===
132+
======================================= test session starts ========================================
133+
platform darwin -- Python 3.7.15, pytest-7.2.2, pluggy-1.0.0 -- /Users/nedbat/coverage/.tox/py37/bin/python
134+
cachedir: .tox/py37/.pytest_cache
135+
rootdir: /Users/nedbat/coverage, configfile: setup.cfg
136+
plugins: flaky-3.7.0, hypothesis-6.70.0, xdist-3.2.1
137+
collected 1330 items / 1320 deselected / 10 selected
138+
run-last-failure: no previously failed tests, not deselecting items.
139+
140+
tests/test_data.py::CoverageDataTest::test_add_to_hash_with_lines PASSED [ 10%]
141+
tests/test_data.py::CoverageDataTest::test_add_to_hash_with_arcs PASSED [ 20%]
142+
tests/test_data.py::CoverageDataTest::test_add_to_lines_hash_with_missing_file PASSED [ 30%]
143+
tests/test_data.py::CoverageDataTest::test_add_to_arcs_hash_with_missing_file PASSED [ 40%]
144+
tests/test_execfile.py::RunPycFileTest::test_running_hashed_pyc PASSED [ 50%]
145+
tests/test_misc.py::HasherTest::test_string_hashing PASSED [ 60%]
146+
tests/test_misc.py::HasherTest::test_bytes_hashing PASSED [ 70%]
147+
tests/test_misc.py::HasherTest::test_unicode_hashing PASSED [ 80%]
148+
tests/test_misc.py::HasherTest::test_dict_hashing PASSED [ 90%]
149+
tests/test_misc.py::HasherTest::test_dict_collision PASSED [100%]
150+
151+
=============================== 10 passed, 1320 deselected in 1.88s ================================
152+
Skipping tests with Python tracer: Only one tracer: no Python tracer for CPython
153+
py37: OK (12.22=setup[2.19]+cmd[0.20,0.36,6.57,2.51,0.20,0.19] seconds)
154+
congratulations :) (13.10 seconds)
121155

122156
You can also affect the test runs with environment variables. Define any of
123157
these as 1 to use them:
@@ -156,7 +190,8 @@ some warnings. Please try to keep it that way, but don't let pylint warnings
156190
keep you from sending patches. I can clean them up.
157191

158192
Lines should be kept to a 100-character maximum length. I recommend an
159-
`editorconfig.org`_ plugin for your editor of choice.
193+
`editorconfig.org`_ plugin for your editor of choice, which will also help with
194+
indentation, line endings and so on.
160195

161196
Other style questions are best answered by looking at the existing code.
162197
Formatting of docstrings, comments, long lines, and so on, should match the

0 commit comments

Comments
 (0)