Skip to content

Translate tests: raise if test class can't be found#259

Merged
romanc merged 4 commits into
NOAA-GFDL:developfrom
romanc:romanc/translate-test-raise-if-not-found
Oct 10, 2025
Merged

Translate tests: raise if test class can't be found#259
romanc merged 4 commits into
NOAA-GFDL:developfrom
romanc:romanc/translate-test-raise-if-not-found

Conversation

@romanc
Copy link
Copy Markdown
Collaborator

@romanc romanc commented Oct 10, 2025

Description

Typing work in #258 highlighted an issue with the translate test configuration in pySHiELD, see NOAA-GFDL/pySHiELD#65. Long story short, if tests aren't registered correctly, they are currently marked as xfail and pytest doesn't complain. The tests also don't run, so 🤷 ...

This PR suggest to raise a ValueError if translate tests aren't properly configured such that users of the test system know that their tests aren't running.

The PR also includes two minor cleanup commit (that were made apparent as part of NOAA-GFDL/pySHiELD#65):

How has this been tested?

All good as long as CI is green. Merging is currently blocked by NOAA-GFDL/pySHiELD#65, which will properly register and skip the translate test for GFSPhysicsDriver.

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
    N/A
  • I have made corresponding changes to the documentation
    N/A
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules
  • New check tests, if applicable, are included

while it is expected for a test to fail if that happens, this isn't
proper usage of the `xfail` marker. because doing so will just hide that
tests aren't running, e.g. see
NOAA-GFDL/pySHiELD#65.
skip_test is an option of our translate test system. let's be nice an
allow users of the translate test system to use that option as part of
the constructor arguments.
Copy link
Copy Markdown
Collaborator

@FlorianDeconinck FlorianDeconinck left a comment

Choose a reason for hiding this comment

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

Well that's a gaping hole in the testing framework... Good thinking.

Copy link
Copy Markdown
Collaborator

@twicki twicki left a comment

Choose a reason for hiding this comment

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

great find, thanks

Copy link
Copy Markdown
Collaborator

@jjuyeonkim jjuyeonkim left a comment

Choose a reason for hiding this comment

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

I like exposing the skip_test too

@romanc
Copy link
Copy Markdown
Collaborator Author

romanc commented Oct 10, 2025

@FlorianDeconinck FYI with the cleanup of the public API / exports of ndsl.initialization, I was able to get rid of the hack to move QuantityFactory all the way to the top in ndsl.__init__.

@romanc romanc enabled auto-merge October 10, 2025 15:30
@FlorianDeconinck
Copy link
Copy Markdown
Collaborator

Nice 🤩

@romanc romanc added this pull request to the merge queue Oct 10, 2025
Merged via the queue into NOAA-GFDL:develop with commit fe8cb5c Oct 10, 2025
5 checks passed
@romanc romanc deleted the romanc/translate-test-raise-if-not-found branch October 10, 2025 17:06
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.

5 participants