Skip to content

CI: don't leak PySB symbols from tests - #591

Merged
dweindl merged 2 commits into
PEtab-dev:mainfrom
dweindl:ci_pysb_leak
Nov 16, 2026
Merged

dweindl merged 2 commits into
PEtab-dev:mainfrom
dweindl:ci_pysb_leak

Conversation

@dweindl

@dweindl dweindl commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

pysb.SelfExporter.cleanup() does not remove a model exported under an explicit name (e.g. pysb.Model("test_model")). The model remained in the test module's globals, so a later test defining a model with the same name failed with SymbolExistsWarning (an error due to filterwarnings = error), depending on test order.

The duplicated uses_pysb fixtures in tests/v1/test_model_pysb.py and tests/v2/test_lint.py are replaced by a shared clean_pysb_exports fixture in tests/conftest.py. It additionally removes the named model, and fails (after removing them) if any other exported PySB symbols remain, so future leaks surface at the leaking test. It yields the cleanup function for use within a test, as needed in test_check_mapping_table.

🤖 Generated with Claude Code

`pysb.SelfExporter.cleanup()` does not remove a model exported under an
explicit name, e.g. `pysb.Model("test_model")`. The model remained in the
test module's globals, and a later test defining a model of the same
name failed with `SymbolExistsWarning`.

Replace the duplicated `uses_pysb` fixtures with a shared
`clean_pysb_exports` fixture that also removes the named model and fails
if other exported PySB symbols remain.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov-commenter

codecov-commenter commented Nov 16, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.52%. Comparing base (e9de650) to head (dd0f29d).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #591   +/-   ##
=======================================
  Coverage   79.52%   79.52%           
=======================================
  Files          70       70           
  Lines        8277     8277           
  Branches     1498     1498           
=======================================
  Hits         6582     6582           
  Misses       1204     1204           
  Partials      491      491           

☔ View full report in Codecov by Harness.
📢 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.

@dweindl
dweindl marked this pull request as ready for review November 16, 2026 14:28
@dweindl
dweindl requested a review from a team as a code owner November 16, 2026 14:28

@dilpath dilpath left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Who tests the tests?

@dweindl
dweindl enabled auto-merge (squash) November 16, 2026 17:50
@dweindl
dweindl merged commit f403be9 into PEtab-dev:main Nov 16, 2026
7 of 13 checks passed
@dweindl
dweindl deleted the ci_pysb_leak branch November 16, 2026 18:04
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