diff --git a/.github/workflows/linux_cuda_wheel.yaml b/.github/workflows/linux_cuda_wheel.yaml index 61d6f50d0..2b39fee44 100644 --- a/.github/workflows/linux_cuda_wheel.yaml +++ b/.github/workflows/linux_cuda_wheel.yaml @@ -138,7 +138,7 @@ jobs: ls - name: Run Python tests run: | - ${CONDA_RUN} FAIL_WITHOUT_CUDA=1 pytest test -v --tb=short + ${CONDA_RUN} FAIL_WITHOUT_CUDA=1 pytest --override-ini="addopts=-v" test --tb=short - name: Run Python benchmark run: | ${CONDA_RUN} time python benchmarks/decoders/gpu_benchmark.py --devices=cuda:0,cpu --resize_devices=none diff --git a/.github/workflows/linux_wheel.yaml b/.github/workflows/linux_wheel.yaml index 1855e904e..706e7c2b4 100644 --- a/.github/workflows/linux_wheel.yaml +++ b/.github/workflows/linux_wheel.yaml @@ -123,4 +123,4 @@ jobs: ls - name: Run Python tests run: | - pytest test -vvv + pytest --override-ini="addopts=-v" test diff --git a/.github/workflows/macos_wheel.yaml b/.github/workflows/macos_wheel.yaml index ee436b7a4..b26a1d2d1 100644 --- a/.github/workflows/macos_wheel.yaml +++ b/.github/workflows/macos_wheel.yaml @@ -122,4 +122,4 @@ jobs: - name: Run Python tests run: | - pytest test -vvv + pytest --override-ini="addopts=-v" test diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f91be9a89..b8d815eec 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -55,10 +55,11 @@ pip install -e ".[dev]" --no-build-isolation -vv To run python tests run: ```bash -pytest test -vvv +pytest ``` -Tip: use the `-k "not slow"` flag to skip slow tests. +Some tests are marked as 'slow' and aren't run by default. You can use `pytest +-m slow` to run those, or `pytest -m ""` to run all tests, slow or not. To run the C++ tests run: diff --git a/pyproject.toml b/pyproject.toml index 98c5473e7..2f8b4da45 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,3 +39,15 @@ target-version = ["py38"] excludes = [ "examples", ] + +[tool.pytest.ini_options] +markers = [ + # defines a 'slow' mark to mark slow tests with `@pytest.mark.slow` + "slow: mark test as slow" +] + +# We don't want to run the slow tests by default. These options are ignored in +# the CI, where we definitely want the 'slow' tests to run. +addopts = "-v -m 'not slow'" + +testpaths = ["test"] diff --git a/test/test_decoders.py b/test/test_decoders.py index 2a48c28c3..d7f53dee3 100644 --- a/test/test_decoders.py +++ b/test/test_decoders.py @@ -422,6 +422,7 @@ def test_iteration(self, device, seek_mode): elif i == 389: assert_frames_equal(ref_frame_last, frame) + @pytest.mark.slow def test_iteration_slow(self): decoder = VideoDecoder(NASA_VIDEO.path) ref_frame_last = NASA_VIDEO.get_frame_data_by_index(389)