Skip to content

Conversation

@rly
Copy link
Contributor

@rly rly commented Sep 28, 2025

Motivation

I found this strange behavior today.
pytest tests/back_compat/test_import_structure.py fails with error
AssertionError: 'testing' not found in ['BuildManager', 'CORE_NAMESPACE', ...

because testing is not part of the pynwb module when you run just import pynwb. That's correct.

However, this test succeeds when we run the full test suite (pytest or python test.py) because other tests have from pynwb.testing import TestCase which adds testing to the pynwb module.

So the test_import_structure test should be corrected to not include "testing" in the checks because it is technically not part of the pynwb module.

How to test the behavior?

pytest tests/back_compat/test_import_structure.py
# or python -m unittest tests/back_compat/test_import_structure.py

Checklist

  • Did you update CHANGELOG.md with your changes?
  • Have you checked our Contributing document?
  • Have you ensured the PR clearly describes the problem and the solution?
  • Is your contribution compliant with our coding style? This can be checked running ruff check . && codespell from the source directory.
  • Have you checked to ensure that there aren't other open Pull Requests for the same change?
  • Have you included the relevant issue number using "Fix #XXX" notation where XXX is the issue number? By including "Fix #XXX" you allow GitHub to close issue #XXX when the PR is merged.

@rly rly requested a review from stephprince September 28, 2025 00:43
@codecov
Copy link

codecov bot commented Sep 28, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.19%. Comparing base (d098db9) to head (76d721f).
⚠️ Report is 1 commits behind head on dev.

Additional details and impacted files
@@           Coverage Diff           @@
##              dev    #2136   +/-   ##
=======================================
  Coverage   95.19%   95.19%           
=======================================
  Files          28       28           
  Lines        2849     2849           
  Branches      736      736           
=======================================
  Hits         2712     2712           
  Misses         83       83           
  Partials       54       54           
Flag Coverage Δ
integration 74.16% <ø> (ø)
unit 85.08% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@rly rly merged commit fa6a214 into dev Sep 28, 2025
26 checks passed
@rly rly deleted the fix_import_test branch September 28, 2025 17:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants