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

consequently use get_testfile #822

Merged
merged 4 commits into from
Jan 18, 2024

Conversation

emanuel-schmid
Copy link
Collaborator

@emanuel-schmid emanuel-schmid commented Dec 1, 2023

Changes proposed in this PR:

  • use the climada.test.get_testfile function where applicable
  • introduce a version distinction in the named function so that test datasets can be updated without breaking tests for previous versions.

PR Author Checklist

PR Reviewer Checklist

@emanuel-schmid emanuel-schmid marked this pull request as draft December 1, 2023 16:11
@emanuel-schmid emanuel-schmid marked this pull request as ready for review December 1, 2023 16:20
@chahank
Copy link
Member

chahank commented Dec 12, 2023

I think the method get_test_file is great. However, the current test file names in CLIMADA are very cryptic. Could we improve on that? Maybe we make better names, or the function allows for a name/description that is more useful?

@emanuel-schmid
Copy link
Collaborator Author

emanuel-schmid commented Dec 13, 2023

renaming the test datasets is a very good idea! However - I'd prefer to do it in another PR. This one doesn't touch the names, only the way to get to the data. And it gets rid of the superfluous climada/hazard/test/data/atl_prob_no_name.mat file!

The main reason for not delaying this is the version check, that allows to update test datasets in the data api without having to touch the code too.

@@ -41,7 +41,7 @@
"""
Directory for writing (and subsequent reading) of temporary files created during tests.
"""
HAZ_TEST_MAT :Path = Path(hazard_test.__file__).parent.joinpath('data', 'atl_prob_no_name.mat')
HAZ_TEST_MAT :Path = get_test_file('atl_prob_no_name', file_format='matlab')
Copy link
Member

Choose a reason for hiding this comment

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

Any reason to sometimes use the HAZ_TEST_MAT :Path = style and sometimes HAZ_TEST_MAT = ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No reason, except that no type annotation has been changed in this PR.

@chahank
Copy link
Member

chahank commented Dec 13, 2023

Can we also add a note in the developers guide to refer to this way of getting test data? Then over time it will harmonize.

@emanuel-schmid
Copy link
Collaborator Author

I've added the note in the Developer Guide PR: a8c6716

@chahank
Copy link
Member

chahank commented Dec 13, 2023

I've added the note in the Developer Guide PR: a8c6716

Excellent!

@chahank
Copy link
Member

chahank commented Dec 13, 2023

Please feel free to merge after updating the changelog.

@emanuel-schmid emanuel-schmid merged commit ca148c0 into develop Jan 18, 2024
9 of 11 checks passed
@emanuel-schmid emanuel-schmid deleted the feature/consequently_use_get_testfile branch January 18, 2024 16:17
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.

2 participants