Skip to content
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
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ test: ## Run the full test suite (mirrors CI)
# about 35 s with it (#1256). Without it the run is serial, and the ten slowest tests are listed either way.
# Each worker's BLAS is limited to one thread: with all of them multi-threaded the CPU is oversubscribed and the
# CPU-heavy explainer smoke test hit its 30 s timeout once.
XDIST := $(shell $(PY) -c "import importlib.util as u; print('-n auto' if u.find_spec('xdist') else '')" 2>/dev/null)
XDIST_ENV := $(if $(XDIST),OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 VECLIB_MAXIMUM_THREADS=1,)
XDIST = $(shell $(PY) -c "import importlib.util as u; print('-n auto' if u.find_spec('xdist') else '')" 2>/dev/null)
XDIST_ENV = $(if $(XDIST),OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 VECLIB_MAXIMUM_THREADS=1,)

test-fast: ## Run the suite without the slow model-training benchmark tests or the Chromium tests (make test-browser), in parallel when pytest-xdist is installed (CI still runs everything)
$(XDIST_ENV) $(PY) -m pytest tests/ -q -m "not slow" --ignore=tests/browser $(XDIST) --durations=10
Expand Down
12 changes: 12 additions & 0 deletions tests/test_makefile.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""The Makefile's targets say what the documentation says they do."""
import os
import re
import subprocess
from pathlib import Path
Expand All @@ -10,6 +11,17 @@ def dry_run(target: str) -> str:
return subprocess.run(["make", "-n", target], cwd=ROOT, capture_output=True, text=True, check=True).stdout


def test_help_does_not_run_python(tmp_path, monkeypatch):
python = tmp_path / "python3"
python.write_text('#!/bin/sh\n: > "$0.called"\nexit 1\n', encoding="utf-8")
python.chmod(0o755)
monkeypatch.setenv("PATH", str(tmp_path), prepend=os.pathsep)

subprocess.run(["make", "help"], cwd=ROOT, capture_output=True, check=True)

assert not python.with_suffix(".called").exists()


def test_test_fast_leaves_the_browser_tests_to_make_test_browser():
# #1263: with Playwright installed `pytest tests/` also collected tests/browser (1,476 tests instead of 1,464)
recipe = dry_run("test-fast")
Expand Down
Loading