From 4d02a93059b648e7128e27346cb26371ceb6e6b1 Mon Sep 17 00:00:00 2001 From: Stijn de Gooijer Date: Wed, 8 Feb 2023 20:30:06 +0100 Subject: [PATCH] Update other code --- .github/workflows/benchmark.yaml | 36 +++++++++---------- .github/workflows/test-python.yaml | 6 ++-- py-polars/Makefile | 6 ++-- py-polars/pyproject.toml | 57 +++++++++++++++--------------- 4 files changed, 50 insertions(+), 55 deletions(-) diff --git a/.github/workflows/benchmark.yaml b/.github/workflows/benchmark.yaml index 3605f5324eba3..6234d696a4626 100644 --- a/.github/workflows/benchmark.yaml +++ b/.github/workflows/benchmark.yaml @@ -5,7 +5,7 @@ on: paths: - "polars/**" - "Cargo.toml" - - "py-polars/tests/db-benchmark/**" + - "py-polars/tests/benchmark/**" - ".github/workflows/benchmark.yaml" concurrency: @@ -21,9 +21,9 @@ jobs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: "3.10" - cache: "pip" - cache-dependency-path: "py-polars/requirements-dev.txt" + python-version: '3.11' + cache: pip + cache-dependency-path: py-polars/requirements-dev.txt - name: Create virtual environment working-directory: py-polars @@ -43,9 +43,9 @@ jobs: r-version: "3.5.3" - name: Generate data - working-directory: py-polars/tests/db-benchmark + working-directory: py-polars/tests/benchmark run: | - Rscript -e 'install.packages("data.table",repos = "https://cloud.r-project.org")' + Rscript -e 'install.packages("data.table", repos="https://cloud.r-project.org")' Rscript groupby-datagen.R 1e7 1e2 5 0 - name: Set up Rust @@ -58,7 +58,7 @@ jobs: with: workspaces: py-polars - - name: Install Polars + - name: Install Polars release build env: RUSTFLAGS: -C embed-bitcode working-directory: py-polars @@ -66,18 +66,14 @@ jobs: source activate maturin develop --release -- -C codegen-units=8 -C lto=thin -C target-cpu=native - - name: Run benchmark tests - lazy versus eager - working-directory: py-polars/tests/db-benchmark - run: python lazy_vs_eager.py + - name: Run H2O AI benchmark - on strings + working-directory: py-polars/tests/benchmark + run: python run_h2oai_benchmark.py on_strings - - name: Run benchmark tests - various - working-directory: py-polars/tests/db-benchmark - run: python various.py + - name: Run H2O AI benchmark - on categoricals + working-directory: py-polars/tests/benchmark + run: python run_h2oai_benchmark.py - - name: Run benchmark tests - on strings - working-directory: py-polars/tests/db-benchmark - run: python main.py on_strings - - - name: Run benchmark tests - on categoricals - working-directory: py-polars/tests/db-benchmark - run: python main.py + - name: Run various benchmark tests + working-directory: py-polars + run: pytest -m benchmark --durations 0 diff --git a/.github/workflows/test-python.yaml b/.github/workflows/test-python.yaml index 3c10b57924ffd..13f944a882da9 100644 --- a/.github/workflows/test-python.yaml +++ b/.github/workflows/test-python.yaml @@ -65,10 +65,10 @@ jobs: maturin develop - name: Run tests and report coverage - run: pytest --cov -n auto -m "slow or not slow" + run: pytest --cov -n auto -m "not benchmark" - name: Run doctests - run: python tests/docs/run_doc_examples.py + run: python tests/docs/run_doctest.py - name: Check import without optional dependencies run: | @@ -129,7 +129,7 @@ jobs: pip install target/wheels/polars-*.whl - name: Run tests - run: pytest -n auto -m "slow or not slow" + run: pytest -n auto -m "not benchmark" - name: Check import without optional dependencies run: | diff --git a/py-polars/Makefile b/py-polars/Makefile index 6678e01fe52bb..3fe607eedcc3a 100644 --- a/py-polars/Makefile +++ b/py-polars/Makefile @@ -46,16 +46,16 @@ test: venv build ## Run fast unittests .PHONY: doctest doctest: venv build ## Run doctests - $(VENV_BIN)/python tests/docs/run_doc_examples.py + $(VENV_BIN)/python tests/docs/run_doctest.py .PHONY: test-all test-all: venv build ## Run all tests $(VENV_BIN)/pytest -n auto -m "slow or not slow" - $(VENV_BIN)/python tests/docs/run_doc_examples.py + $(VENV_BIN)/python tests/docs/run_doctest.py .PHONY: coverage coverage: venv build ## Run tests and report coverage - $(VENV_BIN)/pytest --cov -n auto -m "slow or not slow" + $(VENV_BIN)/pytest --cov -n auto -m "not benchmark" .PHONY: clean clean: ## Clean up caches and build artifacts diff --git a/py-polars/pyproject.toml b/py-polars/pyproject.toml index 6f7adda985c67..b973529a0e8ca 100644 --- a/py-polars/pyproject.toml +++ b/py-polars/pyproject.toml @@ -95,31 +95,6 @@ module = ["polars.*"] # thin wrapper around the PyO3 api to start with. warn_return_any = false -[tool.pytest.ini_options] -addopts = [ - "--import-mode=importlib", - "-m not slow and not hypothesis", # Default to running fast tests only. To run ALL tests, run: pytest -m "" -] -markers = [ - "slow: Tests with a longer than average runtime.", -] - -[tool.coverage.run] -source = ["polars"] -branch = true - -[tool.coverage.report] -fail_under = 85 -skip_covered = true -show_missing = true -exclude_lines = [ - "pragma: no cover", - "@overload", - "except ImportError", - "if TYPE_CHECKING:", - "from typing_extensions import ", -] - [tool.ruff] target-version = "py37" line-length = 88 @@ -178,7 +153,31 @@ ban-relative-imports = "all" [tool.ruff.per-file-ignores] "polars/datatypes.py" = ["B019"] -"tests/*/*.py" = ["D100", "D103"] -"tests/docs/run_doc_examples.py" = ["D101", "D102", "D103"] -"tests/parametric/__init__.py" = ["D104"] -"tests/slow/__init__.py" = ["D104"] +"tests/**/*.py" = ["D100", "D103"] + +[tool.pytest.ini_options] +addopts = [ + "--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", +] +markers = [ + "slow: Tests with a longer than average runtime.", + "benchmark: Tests that should be run on a Polars release build.", +] + +[tool.coverage.run] +source = ["polars"] +branch = true + +[tool.coverage.report] +fail_under = 85 +skip_covered = true +show_missing = true +exclude_lines = [ + "pragma: no cover", + "@overload", + "except ImportError", + "if TYPE_CHECKING:", + "from typing_extensions import ", +]