Skip to content

Commit 05eeaee

Browse files
claudepiotrlaczkowski
authored andcommitted
ci: install only the extras the tests use, and drop the stale asyncio_mode option
The unit-test workflow installed --all-extras, which after the packaging fixes on this branch meant 316 packages: gcp, aws, azure, kfp, sagemaker, mlflow, wandb and the genai stack on top of torch, tensorflow and a set of CUDA wheels. An AST audit of every import in tests/ finds exactly four optional modules - torch, tensorflow, keras and sklearn - and nothing else. tensorflow and scikit-learn already come from the dev group and keras ships inside tensorflow, so `pytorch` is the only extra the suite needs. The genai tests pass without langchain, langgraph or openai installed (they mock the clients), and no test imports mlflow, wandb, azure, kfp, sagemaker or google.cloud at all. The three test jobs now install 188 packages instead of 316 - and instead of the 289 they installed before this branch, so CI is lighter than it was rather than heavier. No coverage is lost: the extras' own correctness is asserted by tests/test_packaging_metadata.py, and the release workflow still performs a full --all-extras install, which is where a broken extra actually matters. Also removes `asyncio_mode = "auto"` from the pytest config. pytest-asyncio is not a dependency, so the option was silently unknown and emitted a PytestConfigWarning on every run. It was also a trap: a future bare `async def test_` would have been collected and never awaited. The suite's four async tests are driven by anyio's pytest plugin through `@pytest.mark.anyio`, which works because anyio ships with starlette - verified by breaking an assertion inside one and confirming it fails rather than passing vacuously. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01S1CErYvpggWAogJ9MDVqj4
1 parent 0756129 commit 05eeaee

2 files changed

Lines changed: 34 additions & 4 deletions

File tree

.github/workflows/UTESTS.yml

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,16 @@ jobs:
6464
run: |
6565
python -m pip install --upgrade pip
6666
pip install poetry
67-
poetry install --no-interaction --with dev --all-extras
67+
# Only the extras the tests actually exercise. An audit of every
68+
# import in tests/ finds torch, tensorflow, keras and sklearn and
69+
# nothing else; tensorflow and scikit-learn already come from the dev
70+
# group, and keras ships with tensorflow, so `pytorch` is the only
71+
# extra left. --all-extras additionally pulled gcp, aws, azure, kfp,
72+
# sagemaker, mlflow, wandb and the genai stack - roughly 30 packages
73+
# and a set of CUDA wheels that no test imports. The extras' own
74+
# correctness is covered by tests/test_packaging_metadata.py and by
75+
# the --all-extras install the release workflow still performs.
76+
poetry install --no-interaction --with dev --extras pytorch
6877
- name: Run smoke tests
6978
run: |
7079
# Run a quick subset of tests for fast feedback
@@ -109,7 +118,16 @@ jobs:
109118
run: |
110119
python -m pip install --upgrade pip
111120
pip install poetry
112-
poetry install --no-interaction --with dev --all-extras
121+
# Only the extras the tests actually exercise. An audit of every
122+
# import in tests/ finds torch, tensorflow, keras and sklearn and
123+
# nothing else; tensorflow and scikit-learn already come from the dev
124+
# group, and keras ships with tensorflow, so `pytorch` is the only
125+
# extra left. --all-extras additionally pulled gcp, aws, azure, kfp,
126+
# sagemaker, mlflow, wandb and the genai stack - roughly 30 packages
127+
# and a set of CUDA wheels that no test imports. The extras' own
128+
# correctness is covered by tests/test_packaging_metadata.py and by
129+
# the --all-extras install the release workflow still performs.
130+
poetry install --no-interaction --with dev --extras pytorch
113131
114132
- name: Run tests - ${{ matrix.test-group }}
115133
run: |
@@ -182,7 +200,16 @@ jobs:
182200
run: |
183201
python -m pip install --upgrade pip
184202
pip install poetry
185-
poetry install --no-interaction --with dev --all-extras
203+
# Only the extras the tests actually exercise. An audit of every
204+
# import in tests/ finds torch, tensorflow, keras and sklearn and
205+
# nothing else; tensorflow and scikit-learn already come from the dev
206+
# group, and keras ships with tensorflow, so `pytorch` is the only
207+
# extra left. --all-extras additionally pulled gcp, aws, azure, kfp,
208+
# sagemaker, mlflow, wandb and the genai stack - roughly 30 packages
209+
# and a set of CUDA wheels that no test imports. The extras' own
210+
# correctness is covered by tests/test_packaging_metadata.py and by
211+
# the --all-extras install the release workflow still performs.
212+
poetry install --no-interaction --with dev --extras pytorch
186213
187214
- name: Run tests with coverage
188215
run: |

pyproject.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,10 @@ python_files = ["test_*.py"]
188188
python_functions = ["test_*"]
189189
# Sequential by default; CI/local can add `-n auto --dist=worksteal` for parallelism
190190
addopts = "-v --cov=flowyml --cov-report=term-missing"
191-
asyncio_mode = "auto"
191+
# No asyncio_mode here: pytest-asyncio is not a dependency, so the option was
192+
# silently unknown and only produced a PytestConfigWarning on every run. The
193+
# suite's async tests are driven by anyio's pytest plugin via
194+
# `@pytest.mark.anyio`, which works because anyio ships with starlette.
192195
# Markers for test organization
193196
markers = [
194197
"slow: marks tests as slow (deselect with '-m \"not slow\"')",

0 commit comments

Comments
 (0)