The Python test suite cannot collect. Found within a minute of restoring CI
(#39), having been invisible since May.
tests/unit/test_unit_core.py:10: in <module>
import numpy as np
E ModuleNotFoundError: No module named 'numpy'
ERROR tests/unit/test_unit_core.py
Interrupted: 1 error during collection
1 error in 0.24s
exit code 2
Two separate problems
numpy is not declared anywhere. No requirements.txt, and nothing in
pyproject.toml or setup.py. The suite depends on it and says so nowhere, so
it works on any machine that happens to have it and nowhere else.
The workflow hides that. ci.yml:44-45
pip install pytest pytest-cov
pip install -r requirements.txt 2>/dev/null || true
requirements.txt does not exist. 2>/dev/null || true turns "there is nothing
to install" into a silent success, so the step is green and the failure surfaces
later as a confusing import error in pytest rather than as "your dependency file
is missing".
That line is doing real harm: it would swallow a genuine pip install failure —
a broken index, a version conflict, a package that no longer resolves — with the
same silence.
Fix
-
Declare the dependency. A requirements.txt with numpy (pinned to a major
at least), or add it to pyproject.toml if this package has one.
-
Stop suppressing the install step. If requirements.txt is meant to be
optional, test for it explicitly rather than discarding all errors:
- name: Install dependencies
run: |
pip install pytest pytest-cov
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
The difference matters: the current form is also green when pip fails for a
reason nobody wants to ignore.
Context
This is the first thing the restored CI found, which is the argument for
restoring it. C/C++ Tests passes; only Python is red. Three months of changes
landed here with no gate, and the count of what else is broken is unknown until
this one is cleared and collection can proceed.
The same trigger bug is fixed in five sibling repositories — eNI#30, eIPC#31,
eDB#70, eBrowser#20, eOffice#40 — and each is likely to surface its own first
failure the same way.
The Python test suite cannot collect. Found within a minute of restoring CI
(#39), having been invisible since May.
Two separate problems
numpy is not declared anywhere. No
requirements.txt, and nothing inpyproject.tomlorsetup.py. The suite depends on it and says so nowhere, soit works on any machine that happens to have it and nowhere else.
The workflow hides that.
ci.yml:44-45requirements.txtdoes not exist.2>/dev/null || trueturns "there is nothingto install" into a silent success, so the step is green and the failure surfaces
later as a confusing import error in pytest rather than as "your dependency file
is missing".
That line is doing real harm: it would swallow a genuine
pip installfailure —a broken index, a version conflict, a package that no longer resolves — with the
same silence.
Fix
Declare the dependency. A
requirements.txtwithnumpy(pinned to a majorat least), or add it to
pyproject.tomlif this package has one.Stop suppressing the install step. If
requirements.txtis meant to beoptional, test for it explicitly rather than discarding all errors:
The difference matters: the current form is also green when
pipfails for areason nobody wants to ignore.
Context
This is the first thing the restored CI found, which is the argument for
restoring it.
C/C++ Testspasses; only Python is red. Three months of changeslanded here with no gate, and the count of what else is broken is unknown until
this one is cleared and collection can proceed.
The same trigger bug is fixed in five sibling repositories — eNI#30, eIPC#31,
eDB#70, eBrowser#20, eOffice#40 — and each is likely to surface its own first
failure the same way.