Skip to content

Level-1 fast tests: memprobe failures appear order-dependent #316

Description

@gthyagi

Summary

tests/test_0780_memprobe.py fails during the default level-1 fast test run, but the same file passes when rerun directly. This looks like order-dependent global-state/test pollution in the fast-mode test path rather than a deterministic memprobe failure.

Environment

  • Repo: underworldcode/underworld3
  • Branch: development
  • Commit: 6451896a (Rotated free-slip: Schur preconditioning parity + 3D rotation nullspace (#306))
  • Local env: amr-dev
  • Platform observed: macOS arm64

Reproduction

After syncing development and rebuilding UW3 in amr-dev:

./uw build
./uw test

The build passed, then the default level-1 fast-mode test run failed with the memprobe failures below.

Observed full level-1 failures

FAILED tests/test_0780_memprobe.py::test_kdtree_live_count_tracks_construction_destruction - AttributeError: module 'underworld3.kdtree' has no attribute 'live_count'
FAILED tests/test_0780_memprobe.py::test_diff_reports_kdtree_growth - KeyError: 'kdtree'
FAILED tests/test_0780_memprobe.py::test_probe_context_emits_when_enabled - AssertionError: assert 'kdtree' in '[memprobe] test-block: no change\n'
FAILED tests/test_0780_memprobe.py::test_mesh_variable_kdtree_caching - AttributeError: module 'underworld3.kdtree' has no attribute 'total_constructed'
FAILED tests/test_0780_memprobe.py::test_swarm_kdtree_caching - AttributeError: module 'underworld3.kdtree' has no attribute 'total_constructed'

The full run ended with:

6 failed, 660 passed, 14 skipped, 782 deselected, 7 xfailed, 1 xpassed

One other failure in that run was unrelated/reproducible in AMR adapt:

FAILED tests/test_0810_amr_swarm_migration_regression.py::test_swarm_migration_after_adapt_does_not_raise - IndexError: index 91 is out of bounds for axis 0 with size 80

Isolation check

Running the memprobe file directly together with the reproducible AMR failure file showed that the memprobe tests pass in isolation:

pytest --config-file=tests/pytest.ini --timeout=120 \
  tests/test_0780_memprobe.py \
  tests/test_0810_amr_swarm_migration_regression.py -q

Result:

...........F
1 failed, 11 passed

Only test_0810_amr_swarm_migration_regression.py failed in this focused run. The memprobe tests passed.

Notes

A fresh import has the expected counters available:

import underworld3 as uw
hasattr(uw.kdtree, "live_count")          # True
hasattr(uw.kdtree, "total_constructed")   # True

The failure pattern suggests that an earlier test in the level-1 fast run may mutate or replace the module object exposed as uw.kdtree, leaving tests/test_0780_memprobe.py to see underworld3.kdtree without the ckdtree counter functions. One suspect is code/tests that import the compatibility wrapper module underworld3.kdtree, but this needs confirmation.

Expected behavior

tests/test_0780_memprobe.py should pass both when run directly and when included in the default level-1 fast test run.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions