From 9609d99772e262f8c6ed703f269a92dcee337dd4 Mon Sep 17 00:00:00 2001 From: PGijsbers Date: Fri, 19 Dec 2025 16:08:02 +0100 Subject: [PATCH 1/6] Add pytest-xdist for parallel testing --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index c506683..d3b013c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -31,6 +31,7 @@ dev = [ "httpx", "hypothesis", "deepdiff", + "pytest-xdist", ] docs = [ "mkdocs-material", From bc9c71ed23791b10c1882e0f10fd2725392b884b Mon Sep 17 00:00:00 2001 From: PGijsbers Date: Fri, 19 Dec 2025 16:39:00 +0100 Subject: [PATCH 2/6] Reduce number of samples from the hypothesis space Mainly because the test runs for long. I will have to look into what an appropriate number is, but I suspect 500 will still find most of the failures that 5000 samples would. --- tests/routers/openml/datasets_list_datasets_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/routers/openml/datasets_list_datasets_test.py b/tests/routers/openml/datasets_list_datasets_test.py index 6e0492e..e60d8ad 100644 --- a/tests/routers/openml/datasets_list_datasets_test.py +++ b/tests/routers/openml/datasets_list_datasets_test.py @@ -225,7 +225,7 @@ def test_list_data_quality(quality: str, range_: str, count: int, py_api: TestCl @pytest.mark.slow @hypothesis.settings( # type: ignore[untyped-decorator] # 108 - max_examples=5000, + max_examples=500, # This number needs to be better motivated suppress_health_check=[hypothesis.HealthCheck.function_scoped_fixture], deadline=None, ) From 65fc6de8f7495a47b1095a61eb70676f19fc16ff Mon Sep 17 00:00:00 2001 From: PGijsbers Date: Fri, 19 Dec 2025 16:50:38 +0100 Subject: [PATCH 3/6] Split up job matrix and parallelize each invocation --- .github/workflows/tests.yml | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index cff3449..e71149e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -12,7 +12,11 @@ permissions: contents: write jobs: - compare-php: + tests: + strategy: + matrix: + php: ["not php_api", "php_api"] + mutations: ["not mut", "mut"] runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 @@ -22,21 +26,7 @@ jobs: # https://github.com/docker/compose/issues/10596 - run: docker compose --profile "python" --profile "php" up --detach --wait --remove-orphans || exit $(docker compose ps -q | xargs docker inspect -f '{{.State.ExitCode}}' | grep -v '^0' | wc -l) - - run: docker exec openml-python-rest-api coverage run -m pytest -v -m "php_api" - - run: docker exec openml-python-rest-api coverage xml - - name: Upload results to Codecov - uses: codecov/codecov-action@v4 - with: - token: ${{ secrets.CODECOV_TOKEN }} - python: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v6 - - uses: actions/setup-python@v6 - with: - python-version: 3.x - - run: docker compose --profile "python" up --detach --wait --remove-orphans || exit $(docker compose ps -q | xargs docker inspect -f '{{.State.ExitCode}}' | grep -v '^0' | wc -l) - - run: docker exec openml-python-rest-api coverage run -m pytest -v -m "not php_api" + - run: docker exec openml-python-rest-api coverage run -m pytest -n auto -v -m "${{ matrix.php }} and ${{ matrix.mutations }}" - run: docker exec openml-python-rest-api coverage xml - name: Upload results to Codecov uses: codecov/codecov-action@v4 From 1ad0318790be79b0d806c8dbc11045248be8868a Mon Sep 17 00:00:00 2001 From: PGijsbers Date: Fri, 19 Dec 2025 17:06:28 +0100 Subject: [PATCH 4/6] Change types of parametrization and avoid starting php if possible --- .github/workflows/tests.yml | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e71149e..6662399 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -15,8 +15,8 @@ jobs: tests: strategy: matrix: - php: ["not php_api", "php_api"] - mutations: ["not mut", "mut"] + php_api: [true, false] + mutations: [true, false] runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 @@ -25,9 +25,20 @@ jobs: python-version: 3.x # https://github.com/docker/compose/issues/10596 - - run: docker compose --profile "python" --profile "php" up --detach --wait --remove-orphans || exit $(docker compose ps -q | xargs docker inspect -f '{{.State.ExitCode}}' | grep -v '^0' | wc -l) - - run: docker exec openml-python-rest-api coverage run -m pytest -n auto -v -m "${{ matrix.php }} and ${{ matrix.mutations }}" - - run: docker exec openml-python-rest-api coverage xml + - name: Start services + run: | + profiles="--profile python" + if [ "${{ matrix.php_api }}" = "true" ]; then + profiles="$profiles --profile php" + fi + docker compose $profiles up --detach --wait --remove-orphans || exit $(docker compose ps -q | xargs docker inspect -f '{{.State.ExitCode}}' | grep -v '^0' | wc -l) + + - name: Run tests + run: | + marker="${{ matrix.php_api == true && 'php_api' || 'not php_api' }} and ${{ matrix.mutations == true && 'mut' || 'not mut' }}" + docker exec openml-python-rest-api coverage run -m pytest -n auto -v -m "$marker" + - name: Produce coverage report + run: docker exec openml-python-rest-api coverage xml - name: Upload results to Codecov uses: codecov/codecov-action@v4 with: From 664436d0005210531555a69d834a2ed35ff41c6f Mon Sep 17 00:00:00 2001 From: PGijsbers Date: Fri, 19 Dec 2025 17:13:25 +0100 Subject: [PATCH 5/6] Give a readable name to each job --- .github/workflows/tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6662399..5dd1082 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -13,6 +13,7 @@ permissions: jobs: tests: + name: "${{ matrix.php_api == true && 'Migration' || 'Unit' }} ${{ matrix.mutations == true && 'write' || 'read-only' }} tests" strategy: matrix: php_api: [true, false] From 99c39861bc450fc6a7f302fd01c73c61cc55aa39 Mon Sep 17 00:00:00 2001 From: PGijsbers Date: Fri, 19 Dec 2025 17:16:01 +0100 Subject: [PATCH 6/6] [no ci] use names that are clearer --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 5dd1082..18f61a4 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -13,7 +13,7 @@ permissions: jobs: tests: - name: "${{ matrix.php_api == true && 'Migration' || 'Unit' }} ${{ matrix.mutations == true && 'write' || 'read-only' }} tests" + name: "${{ matrix.php_api == true && 'Migration' || 'Python-only' }} ${{ matrix.mutations == true && 'with mutations' || 'read-only' }}" strategy: matrix: php_api: [true, false]