Skip to content

tests: pass when missing torch#1400

Merged
casperdcl merged 1 commit into
masterfrom
pytest-torch-collect
May 13, 2026
Merged

tests: pass when missing torch#1400
casperdcl merged 1 commit into
masterfrom
pytest-torch-collect

Conversation

@casperdcl
Copy link
Copy Markdown
Member

Allows e.g. SuperBuild ctest to pass without installing torch.

@casperdcl casperdcl self-assigned this May 12, 2026
@casperdcl casperdcl added the bug label May 12, 2026
casperdcl added a commit to SyneRBI/SIRF-SuperBuild that referenced this pull request May 12, 2026
casperdcl added a commit to SyneRBI/SIRF-SuperBuild that referenced this pull request May 12, 2026
Copy link
Copy Markdown
Contributor

@paskino paskino left a comment

Choose a reason for hiding this comment

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

Currently the reason why the SB failed was that torch wasn't installed on the CI so pytest didn't run any test; careful developers decided that in this situation you should fail catastrofically, but without a reasonable error message.

We haven't understood the reason of the SB failure for a while, despite the hints in the coverage warning message.

Therefore, I would add this test to the test_torch.py with appropriate message regarding whether torch is installed or not.

@casperdcl
Copy link
Copy Markdown
Member Author

casperdcl commented May 13, 2026

test_torch.py has the importorskip + lots of dependent imports & config at the top; refactoring it would be very painful (to allow a non-skipped test in the same file).

Best to just keep the dummy test in a separate file.

@casperdcl casperdcl merged commit 5042e06 into master May 13, 2026
5 of 6 checks passed
@casperdcl casperdcl deleted the pytest-torch-collect branch May 13, 2026 07:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants