From 1ec9af12cd8ef965f2e59609eb4ffa5050d6b25f Mon Sep 17 00:00:00 2001 From: George Pearse Date: Sun, 2 Nov 2025 22:56:20 +0000 Subject: [PATCH] Integrate testmon for optimized test execution - Add pytest-testmon to test dependencies - Add pytest-watch for development convenience - Update GitHub Actions workflow to use testmon - Only relevant tests run based on code changes - Falls back to full suite if optimized run fails - Speeds up CI feedback for PRs with targeted changes --- .github/workflows/tests.yml | 44 +++++++++++++++++++++++++++++++++++++ pyproject.toml | 2 +- 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..05fdeb9 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,44 @@ +name: Tests + +on: + push: + branches: [ master, develop ] + pull_request: + branches: [ master, develop ] + +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.9", "3.10", "3.11", "3.12"] + + steps: + - uses: actions/checkout@v3 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -e . + pip install pytest pytest-cov pytest-testmon + + - name: Run tests (optimized with testmon) + run: | + pytest umap/tests/ -v --cov=umap --cov-report=xml --testmon + continue-on-error: true + + - name: Run full test suite if optimized run failed + if: failure() + run: | + pytest umap/tests/ -v --cov=umap --cov-report=xml + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v3 + with: + files: ./coverage.xml + fail_ci_if_error: false diff --git a/pyproject.toml b/pyproject.toml index bbaf975..b3268c7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -59,7 +59,7 @@ plot = [ ] parametric_umap = ["tensorflow >= 2.1"] tbb = ["tbb >= 2019.0"] -test = ["pytest"] +test = ["pytest", "pytest-testmon", "pytest-watch"] [tool.setuptools] packages = ["umap"]