Skip to content

Remove unused pytest fixtures - #3840

Closed
parthdembla007 wants to merge 2 commits into
tardis-sn:masterfrom
parthdembla007:remove-unused-test-fixtures
Closed

parthdembla007 wants to merge 2 commits into
tardis-sn:masterfrom
parthdembla007:remove-unused-test-fixtures

Conversation

@parthdembla007

Copy link
Copy Markdown

What does this PR do?

Removes pytest fixtures that no test uses, addressing #1858.

The fixture list in #1858 is from 2022, and all of those fixtures have since been removed or renamed. I reran pytest-deadfixtures on current master with regression data enabled (pytest --dead-fixtures tardis --tardis-regression-data=...). This PR removes the unused fixtures that haven't been touched recently.

Changes

Fixture / file Location Note
tardis/energy_input/tests/test_gamma_ray_transport.py (whole file) energy_input/tests The module has no test functions. It holds three fixtures (gamma_ray_config → gamma_ray_simulation_state → gamma_ray_model_state) that nothing uses, plus 7 unused imports (ruff F401). It was last changed in #2552 (April 2024).
he_test_config_yaml, he_test_config_csvy workflows/high_energy/tests/conftest.py Unused. he_test_config_csvy also points to tardis_he_test_config_csvy.yml, which doesn't exist in data/.
simple_isotope_abundance model/tests/test_base.py Unused. I also removed its IsotopicMassFraction import, which nothing else uses.
artis_abundances_fname io/model/readers/tests/test_model_reader.py Unused here. The fixture with the same name in tardis/tests/test_util.py is used and stays.
vpacket_collection transport/montecarlo/tests/conftest.py Unused.
config plasma/radiation_field/tests/test_dilute_planckian_rad_field.py Unused. simulation_state builds its own Configuration.

No library code changed; only test code.

Left in place (please advise)

pytest-deadfixtures also reports these, but they were added this year, so they may be meant for upcoming tests. I left them alone:

I can remove them in this PR if you'd like.

Testing

Run in a tardis env created from conda-linux-64.lock, with tardisbase installed:

  • pytest tardis/model/tests/test_base.py tardis/workflows/high_energy/tests tardis/io/model/readers/tests/test_model_reader.py tardis/plasma/radiation_field/tests tardis/transport/montecarlo/tests tardis/energy_input/tests --tardis-regression-data=... gives the same results on this branch as on master: 297 passed, 11 skipped, 5 xfailed, and 32 failed on both. The 32 failures are also on master: they are load errors (OSError/UnpicklingError) because I fetched only part of the LFS regression data locally.
  • pytest --dead-fixtures tardis --tardis-regression-data=... now reports only the three fixtures listed above.
  • ruff check --select F and ruff format --check are clean on the changed files. The 7 F401 errors from the deleted module are gone.

I haven't run the full test suite.

I also added myself to .mailmap so the mailmap check passes.

AI disclosure

This PR was prepared with help from Claude Code (finding dead fixtures, editing, running checks). I reviewed the changes.

Closes #1858

Remove fixtures reported by pytest-deadfixtures that no test uses,
including test_gamma_ray_transport.py, which contained only unused
fixtures and imports. Add .mailmap entry.

Closes tardis-sn#1858

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tardis-bot

Copy link
Copy Markdown
Contributor

*beep* *bop*

Hi, human.

I'm the @tardis-bot and I noticed that your email is not associated with an ORCID ID in our database.

Please add your email and ORCID ID to the .orcid.csv file in your current branch and push the changes to this pull request.

If you don't have an ORCID ID yet, you can create one for free at orcid.org. ORCID IDs help ensure you get proper credit for your scientific contributions.

The format should be:

email,orcid
your.email@example.com,0000-0000-0000-0000

Runs: ORCID check · comment publisher

@tardis-bot

Copy link
Copy Markdown
Contributor

👋 Welcome @parthdembla007! Thank you for your first contribution to this repository!

A reviewer will take a look at your pull request soon.

Please mark the pull request as draft if you are not ready for review yet or if there are things you will be adding.

@codecov

codecov Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 71.37%. Comparing base (3128005) to head (f3733eb).
⚠️ Report is 7 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3840      +/-   ##
==========================================
+ Coverage   71.35%   71.37%   +0.02%     
==========================================
  Files         207      207              
  Lines       15983    16007      +24     
==========================================
+ Hits        11404    11425      +21     
- Misses       4579     4582       +3     

☔ 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.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@connor-mcclellan

Copy link
Copy Markdown
Contributor

Thanks for the contribution - the team looked at this and we're going to go through this ourselves to make sure we don't accidentally delete anything we need. I've changed the label on the issue to internal-dev only.

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.

Address fixtures that are not being used

3 participants