Commit 45d3ea3
fix: avoid importing linopy at pytest config-parse time
The filter ``"ignore::linopy.EvolvingAPIWarning"`` forces pytest to
import ``linopy`` when parsing pyproject.toml to resolve the class
reference. That eager import loads ``linopy.variables`` from
site-packages — and then ``pytest --doctest-modules linopy`` (used in
the Windows CI job that installs from a built wheel) tries to collect
``linopy/variables.py`` from the source tree, sees the module is
already imported from a different path, and fails every doctest
collection with the "not the same as the test file we want to
collect" error.
Switch to a message-based filter on the builtin FutureWarning:
"ignore:piecewise:FutureWarning"
Our EvolvingAPIWarning is a FutureWarning subclass with messages that
all start with "piecewise:", so the filter still catches them.
FutureWarning is a builtin so pytest doesn't need to import linopy to
resolve it. CI collection recovers.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 646882b commit 45d3ea3
1 file changed
Lines changed: 8 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
116 | | - | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
117 | 124 | | |
118 | 125 | | |
119 | 126 | | |
| |||
0 commit comments