Skip to content

Fix pytest collection errors#603

Open
patkenneally wants to merge 17 commits into
developfrom
feature/fix-test-warnings
Open

Fix pytest collection errors#603
patkenneally wants to merge 17 commits into
developfrom
feature/fix-test-warnings

Conversation

@patkenneally
Copy link
Copy Markdown
Collaborator

Description

Switch pytest to --import-mode=importlib so test modules no longer require package-style __init__.py files.

This PR also resolves a range of pytest warnings summary from the test suite;

  • simpleVoltEstimator, coarseSunSensor, imuSensor, orbElemConvert, Integrators, scenarioIntegrators.
  • Import mode: added pytest_collectstart hook that puts each test module's directory on sys.path; converted test_thrForceMapping.py and test_lambertSolver.py to Support.X imports; adjusted pytest.ini to --import-mode=importlib.

Verification

Successful CI and absence of pytest warnings.

Documentation

NA

Future work

None

The warning originates in datashader/hvplot, not xmera, so suppress FutureWarnings from dask.dataframe at the pytest layer (module-scoped because the message begins with a newline that defeats pytest's anchored regex).
The S frame is defined as cross(omega, r0)/|cross(omega, r0)|, so omega = 0 is degenerate and produces NaN truth values.
…test

The existing zero-norm check fired after the divide; reordering avoids the RuntimeWarning without changing observable behavior.
matplotlib silently discards figsize/dpi/etc. when figure N already exists, so close it first so the styling args take effect.
matplotlib silently discards figsize/dpi/etc. when figure N already exists, so close it first so the styling args take effect.
matplotlib silently discards figsize/dpi/etc. when figure 1 already exists, so close it first so the styling args take effect.
matplotlib silently discards figsize/dpi/etc. when figure N already exists, so close each first so the styling args take effect.
The 13-case parametrize leaves figures open across iterations, so later iterations silently discard the styling args.
The 5-case parametrize leaves figures open across iterations, so later iterations silently discard the styling args.
The large parametrize matrix leaves figure 1 open across iterations, so later iterations silently discard the styling args.
The prior 'if integratorCase == rk4' guard only reset state on the first iteration, leaving later cases unstyled.
The prior 'if integratorCase == rk4' guard only reset state on the first call, leaving later cases unstyled.
Lets test files use bare-name imports like `from Support.X import Y` without requiring the surrounding directories to be Python packages, which is what unblocks switching to importlib mode.
Drops the leading dot so the import no longer requires the test file to be loaded as part of a package; the conftest collect hook adds the test's directory to sys.path so Support resolves directly.
Drops the fswAlgorithms.orbitControl.lambertSolver._UnitTest prefix so the import no longer requires those directories to be packages on sys.path.
Removes the need for __init__.py files in test directories and isolates test module imports from each other; bare-name Support imports and the conftest sys.path hook keep collection working.
Each worker appends the current test nodeid to its own log file; tailing the files identifies which test was running just before a stall or worker crash.
@patkenneally patkenneally changed the title Feature/fix test warnings Fix pytest collection errors May 11, 2026
@patkenneally patkenneally self-assigned this May 11, 2026
@patkenneally patkenneally linked an issue May 11, 2026 that may be closed by this pull request
from xmera.utilities import orbitalMotion

from fswAlgorithms.orbitControl.lambertSolver._UnitTest.Support.IzzoLambert import *
from Support.IzzoLambert import *
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

pytest test files with name collisions collection errors

1 participant