Skip to content

Commit 635e3fc

Browse files
CONTRIBUTING: Add suggestion about passing pytest flags (#2738)
1 parent 79b0e2c commit 635e3fc

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

.github/CONTRIBUTING.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,14 +126,26 @@ cmake --build build --target check
126126
`--target` can be spelled `-t` in CMake 3.15+. You can also run individual
127127
tests with these targets:
128128

129-
* `pytest`: Python tests only
129+
* `pytest`: Python tests only, using the
130+
[pytest](https://docs.pytest.org/en/stable/) framework
130131
* `cpptest`: C++ tests only
131132
* `test_cmake_build`: Install / subdirectory tests
132133

133134
If you want to build just a subset of tests, use
134135
`-DPYBIND11_TEST_OVERRIDE="test_callbacks.cpp;test_pickling.cpp"`. If this is
135136
empty, all tests will be built.
136137

138+
You may also pass flags to the `pytest` target by editing `tests/pytest.ini` or
139+
by using the `PYTEST_ADDOPTS` environment variable
140+
(see [`pytest` docs](https://docs.pytest.org/en/2.7.3/customize.html#adding-default-options)). As an example:
141+
142+
```bash
143+
env PYTEST_ADDOPTS="--capture=no --exitfirst" \
144+
cmake --build build --target pytest
145+
# Or using abbreviated flags
146+
env PYTEST_ADDOPTS="-s -x" cmake --build build --target pytest
147+
```
148+
137149
### Formatting
138150

139151
All formatting is handled by pre-commit.

0 commit comments

Comments
 (0)