Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

292 flaky tests #293

Merged
merged 27 commits into from
Dec 9, 2024
Merged

292 flaky tests #293

merged 27 commits into from
Dec 9, 2024

Conversation

charles-turner-1
Copy link
Collaborator

Reverting addition of MOM6 stuff seemed to fix tests (CI :X: on initial commit is due to codecov, tests all passed).

  • Note that unreverting (revert revert) tests actually passed on Python3.10, but failed on 3.13 as CI shut everything down after 3.13 failure.

Closes #292 ... when we understand what's going on.

This reverts commit 8d18b19.

Testing to see whether this restores test stability
This reverts commit 23b3b5f - ie. it
restores the mom6 stuff.
@charles-turner-1
Copy link
Collaborator Author

Note - I only opened a PR to trigger the CI runs.

Copy link

codecov bot commented Dec 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.49%. Comparing base (8a1b1d9) to head (203ab43).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #293      +/-   ##
==========================================
+ Coverage   98.44%   98.49%   +0.04%     
==========================================
  Files          11       11              
  Lines         838      996     +158     
==========================================
+ Hits          825      981     +156     
- Misses         13       15       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@charles-turner-1 charles-turner-1 self-assigned this Dec 8, 2024
@charles-turner-1 charles-turner-1 marked this pull request as ready for review December 8, 2024 03:31
@charles-turner-1
Copy link
Collaborator Author

This should fix all the MOM6 issues.

  • I'm not entirely happy with the fix - it's more of a sidestep than anything & we will need to take a closer look at the cftime dependency which is the source of issue, but other than fixing coverage this should resolve all the problems we were having with Mom6 stuff.

TLDR; the time bounds in the mom6 model cause a lot of issues.

@charles-turner-1
Copy link
Collaborator Author

charles-turner-1 commented Dec 9, 2024

Should be ready for review. There's one line that just needs mocking - we need to patch in an empty list here, but I'm struggling to work out why mocking a dataclass attribute won't work.

595        if not dvars.variable_list:
596           raise EmptyFileError("This file contains no variables")

Once we get that solved, codecov should pass & everything should be working again (touch wood).

def parse_access_ncfile(
cls, file: str, time_dim: str = "time"
) -> _AccessNCFileInfo:
def parse_ncfile(cls, file: str, time_dim: str = "time") -> _NCFileInfo:
"""
Get Intake-ESM datastore entry info from an ACCESS netcdf file
Copy link
Collaborator

Choose a reason for hiding this comment

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

May need to alter this description

@@ -545,6 +544,70 @@ def parser(cls, file):
except Exception:
return {INVALID_ASSET: file, TRACEBACK: traceback.format_exc()}

@classmethod
def parse_ncfile(cls, file: str, time_dim: str = "time") -> _NCFileInfo:
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is still a line-for-line copy of BaseBuilder.parse_ncfile, just with the time parser object changed. Is it workable to add a time_parser kwarg to BaseBuilder.parse_ncfile, and just inherit from there?

If you want clearer separation, your other option might be to come up with a Mixin solution that defines parse_ncfile separately (which is workable, given it's a classmethod.)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ahh gotcha - yeah, the first solution makes a lot more sense than what I've got here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Turned out to be easier from a Liskov perspective to just add the time parser as a class attribute - but I think the changes should address your points.

If you're happy, I think we should be ready to merge this in.

@marc-white
Copy link
Collaborator

Looks good to me, modulo my comments above.

Copy link
Collaborator

@marc-white marc-white left a comment

Choose a reason for hiding this comment

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

Approved to merge.

@marc-white marc-white merged commit 2f5ba48 into main Dec 9, 2024
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

[BUG] tests/test_builders.py::test_builder_build Flaky
2 participants