Skip to content

fix(components): warn when hits_and_kdst_from_files skips a file - #974

Closed
aniruddhaadak80 wants to merge 1 commit into
next-exp:masterfrom
aniruddhaadak80:fix/hits-and-kdst-missing-node-warning
Closed

aniruddhaadak80 wants to merge 1 commit into
next-exp:masterfrom
aniruddhaadak80:fix/hits-and-kdst-missing-node-warning

Conversation

@aniruddhaadak80

Copy link
Copy Markdown

What

  • Warn with the skipped filename when hits_and_kdst_from_files catches NoSuchNodeError from load_dst.
  • Add a focused regression test covering a file with no requested tables.

Why

The existing catch continues with the next file without any signal, so a missing hits or kdst table is indistinguishable from empty input. Emitting a UserWarning makes the skip visible while preserving the function's current skip behavior.

Tests

This contribution was prepared entirely through the GitHub API (remote-only); tests were not run locally.

Targeted:

source scripts/setup_conda_gha.sh
source manage.sh activate
pytest -v invisible_cities/cities/components_test.py::test_hits_and_kdst_from_files_missing_nodes_warns

Full suite (same command used by the Test suite workflow):

source scripts/setup_conda_gha.sh
source manage.sh activate
PYTEST_ADDOPTS=--color=yes HYPOTHESIS_PROFILE=travis-ci bash manage.sh run_tests_par

Fixes #956

hits_and_kdst_from_files catches NoSuchNodeError from load_dst and
continues with the next file without any warning, so a missing hits
or kdst table looks like empty input.

Emit a UserWarning naming the skipped file while preserving the
existing skip behavior, and cover it with a regression test.

Fixes next-exp#956
@gonzaponte gonzaponte closed this Sep 25, 2026
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.

hits_and_kdst_from_files() fails silently

2 participants