Skip to content

Commit f93d222

Browse files
authored
Improve pytest default options (#794)
1 parent ee42162 commit f93d222

File tree

6 files changed

+19
-5
lines changed

6 files changed

+19
-5
lines changed

.github/workflows/linux_cuda_wheel.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ jobs:
140140
ls
141141
- name: Run Python tests
142142
run: |
143-
${CONDA_RUN} FAIL_WITHOUT_CUDA=1 pytest test -v --tb=short
143+
${CONDA_RUN} FAIL_WITHOUT_CUDA=1 pytest --override-ini="addopts=-v" test --tb=short
144144
- name: Run Python benchmark
145145
run: |
146146
${CONDA_RUN} time python benchmarks/decoders/gpu_benchmark.py --devices=cuda:0,cpu --resize_devices=none

.github/workflows/linux_wheel.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,4 +123,4 @@ jobs:
123123
ls
124124
- name: Run Python tests
125125
run: |
126-
pytest test -vvv
126+
pytest --override-ini="addopts=-v" test

.github/workflows/macos_wheel.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,4 +122,4 @@ jobs:
122122
123123
- name: Run Python tests
124124
run: |
125-
pytest test -vvv
125+
pytest --override-ini="addopts=-v" test

CONTRIBUTING.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,11 @@ pip install -e ".[dev]" --no-build-isolation -vv
5555
To run python tests run:
5656

5757
```bash
58-
pytest test -vvv
58+
pytest
5959
```
6060

61-
Tip: use the `-k "not slow"` flag to skip slow tests.
61+
Some tests are marked as 'slow' and aren't run by default. You can use `pytest
62+
-m slow` to run those, or `pytest -m ""` to run all tests, slow or not.
6263

6364
To run the C++ tests run:
6465

pyproject.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,15 @@ target-version = ["py38"]
3939
excludes = [
4040
"examples",
4141
]
42+
43+
[tool.pytest.ini_options]
44+
markers = [
45+
# defines a 'slow' mark to mark slow tests with `@pytest.mark.slow`
46+
"slow: mark test as slow"
47+
]
48+
49+
# We don't want to run the slow tests by default. These options are ignored in
50+
# the CI, where we definitely want the 'slow' tests to run.
51+
addopts = "-v -m 'not slow'"
52+
53+
testpaths = ["test"]

test/test_decoders.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,7 @@ def test_iteration(self, device, seek_mode):
422422
elif i == 389:
423423
assert_frames_equal(ref_frame_last, frame)
424424

425+
@pytest.mark.slow
425426
def test_iteration_slow(self):
426427
decoder = VideoDecoder(NASA_VIDEO.path)
427428
ref_frame_last = NASA_VIDEO.get_frame_data_by_index(389)

0 commit comments

Comments
 (0)