Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Run non-benchmark tests in benchmark workflow #15207

Merged
merged 3 commits into from
Mar 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ jobs:
with:
python-version: '3.12'

- name: Set up Graphviz
uses: ts-graphviz/setup-graphviz@v2

- name: Create virtual environment
run: |
python -m venv .venv
Expand Down Expand Up @@ -100,4 +103,8 @@ jobs:

- name: Run various benchmark tests
working-directory: py-polars
run: pytest -m benchmark --durations 0 -v
run: pytest -m release --durations 0 -v

- name: Run non-benchmark tests
working-directory: py-polars
run: pytest -m 'not release and not debug' -n auto --dist loadgroup
7 changes: 4 additions & 3 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ jobs:
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov

- uses: Swatinem/rust-cache@v2
- name: Cache Rust
uses: Swatinem/rust-cache@v2
with:
save-if: ${{ github.ref_name == 'main' }}

Expand Down Expand Up @@ -85,13 +86,13 @@ jobs:
run: maturin develop

- name: Run Python tests
run: pytest --cov -n auto --dist loadgroup -m "not benchmark and not docs" --cov-report xml:main.xml
run: pytest --cov -n auto --dist loadgroup -m "not release and not docs" --cov-report xml:main.xml
continue-on-error: true

- name: Run Python tests - async reader
env:
POLARS_FORCE_ASYNC: 1
run: pytest --cov -m "not benchmark and not docs" tests/unit/io/ --cov-report xml:async.xml
run: pytest --cov -m "not release and not docs" tests/unit/io/ --cov-report xml:async.xml
continue-on-error: true

- name: Report coverage
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,13 @@ jobs:
# Currently skipped due to performance issues in coverage:
# https://github.com/nedbat/coveragepy/issues/1665
COV: ${{ !(matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12') && '--cov' || '--no-cov' }}
run: pytest $COV -n auto --dist loadgroup -m "not benchmark and not docs"
run: pytest $COV -n auto --dist loadgroup -m "not release and not docs"

- name: Run tests async reader tests
if: github.ref_name != 'main' && matrix.os != 'windows-latest'
env:
POLARS_FORCE_ASYNC: 1
run: pytest -m "not benchmark and not docs" tests/unit/io/
run: pytest -m "not release and not docs" tests/unit/io/

- name: Check import without optional dependencies
if: github.ref_name != 'main' && matrix.python-version == '3.12' && matrix.os == 'ubuntu-latest'
Expand Down
4 changes: 2 additions & 2 deletions docs/development/contributing/test.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,10 @@ Refer to the [benchmark workflow](https://github.com/pola-rs/polars/blob/main/.g
### Running other benchmark tests

The other benchmark tests are run using pytest.
Run `pytest -m benchmark --durations 0 -v` to run these tests and report run duration.
Run `pytest -m release --durations 0 -v` to run these tests and report run duration.

Note that benchmark tests are excluded by default when running `pytest`.
You must explicitly specify `-m benchmark` to run them.
You must explicitly specify `-m release` to run them.
They will also be excluded when calculating test coverage.

These tests _will_ be run as part of the `make test-all` make command.
2 changes: 1 addition & 1 deletion py-polars/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ test-all: .venv build ## Run all tests

.PHONY: coverage
coverage: .venv build ## Run tests and report coverage
$(VENV_BIN)/pytest --cov -n auto --dist loadgroup -m "not benchmark"
$(VENV_BIN)/pytest --cov -n auto --dist loadgroup -m "not release"

.PHONY: clean
clean: ## Clean up caches and build artifacts
Expand Down
5 changes: 3 additions & 2 deletions py-polars/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -205,12 +205,13 @@ addopts = [
"--strict-markers",
"--import-mode=importlib",
# Default to running fast tests only. To run ALL tests, run: pytest -m ""
"-m not slow and not hypothesis and not benchmark and not write_disk and not docs",
"-m not slow and not hypothesis and not release and not write_disk and not docs",
]
markers = [
"write_disk: Tests that write to disk",
"slow: Tests with a longer than average runtime.",
"benchmark: Tests that should be run on a Polars release build.",
"release: Tests that should be run on a Polars release build.",
"debug: Tests that should be run on a Polars debug build.",
"docs: Documentation code snippets",
]
filterwarnings = [
Expand Down
4 changes: 2 additions & 2 deletions py-polars/tests/benchmark/test_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

Tests in this module will be run in the CI using a release build of Polars.

To run these tests: pytest -m benchmark
To run these tests: pytest -m release
"""

import time
Expand All @@ -17,7 +17,7 @@
from polars.testing import assert_frame_equal

# Mark all tests in this module as benchmark tests
pytestmark = pytest.mark.benchmark()
pytestmark = pytest.mark.release()


@pytest.mark.skipif(
Expand Down
1 change: 1 addition & 0 deletions py-polars/tests/unit/streaming/test_streaming_sort.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ def test_ooc_sort(tmp_path: Path, monkeypatch: Any) -> None:
assert_series_equal(out, s.sort(descending=descending))


@pytest.mark.debug()
@pytest.mark.write_disk()
@pytest.mark.parametrize("spill_source", [True, False])
def test_streaming_sort(
Expand Down
1 change: 1 addition & 0 deletions py-polars/tests/unit/test_cse.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ def test_schema_row_index_cse() -> None:
assert_frame_equal(result, expected)


@pytest.mark.debug()
def test_cse_expr_selection_context(monkeypatch: Any, capfd: Any) -> None:
monkeypatch.setenv("POLARS_VERBOSE", "1")
q = pl.LazyFrame(
Expand Down
Loading