-
Notifications
You must be signed in to change notification settings - Fork 36
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
Fix project data interface and add unittests for job and project data interfaces #278
Conversation
Codecov Report
@@ Coverage Diff @@
## master #278 +/- ##
=======================================
Coverage 64.87% 64.88%
=======================================
Files 40 40
Lines 5623 5624 +1
=======================================
+ Hits 3648 3649 +1
Misses 1975 1975 Continue to review full report at Codecov.
|
In the $ signac shell
>>> pr.data['a'] = np.zeros([10])
>>> with pr.data as store:
... store.a[:]
...
array([0., 0., 0., 0., 0., 0., 0., 0., 0., 0.]) While $ signac shell
>>> pr.data['a'] = np.zeros([10])
>>> with pr.data:
... pr.data.a[:]
... returns an error. The current unit tests, which inherit from If the goal is to add unit tests which can catch the bug reported in #274, would it be best to test both instances? |
@klywang Yes, we should definitely test both cases! Both are valid and should work the same. Note that the |
@bdice Okay I can add tests for both instances after the testing framework has been updated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Running signac from this branch fixed issue #274 for me. I'm not sure what's happening with the ProjectStoreTests--will they be added later?
@jennyfothergill Good question! The test classes like The class ProjectStoreTest(BaseProjectStoreTest, test_h5store.H5StoreTest):
pass Everything in this class (the setup and the tests) is defined by inheritance. It's not actually empty, as it appears. The FYI, this picture (and the class names in particular) may change when we shift to pytest. |
Oh! Wow, thank you so much for the great explanation! I think I understand. |
@klywang I updated this PR to match pytest. The tests appear to be running correctly with pytest. Next steps:
If you want to run the tests locally, you'll need to install Use |
This should be for review now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I reviewed this PR again -- it looks good to me. The only missing part was a changelog entry, so I added one. Thanks @klywang! This PR needs one more approval from @zhou-pj or @jennyfothergill to proceed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! Just have a few minor comments and clarification questions.
project_class = signac.Project | ||
|
||
@pytest.fixture(autouse=True) | ||
def setUp_base_h5Store(self, request): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a minor questions and not directly introduced by this PR, but I noticed a few functions with the @pytest.fixture that are using a mixture of camelCase and underscore for function name. Is there a reason for that?
Co-Authored-By: Pengji <[email protected]>
Co-Authored-By: Pengji <[email protected]>
Description
project.data
used to return a newH5StoreManager
each time it was called. This prevented users from reading arrays previously stored using theproject.data
interface.Unit tests covered scalars and strings, but did not cover arrays or pandas dataframes.
Motivation and Context
Resolves issue #274. Arrays stored using
project.data
cannot be accessed using theproject.data
interface.These interfaces were not tested comprehensively in unit tests.
This pull request is still in progress.
Types of Changes
1The change breaks (or has the potential to break) existing functionality.
Checklist:
If necessary:
Example for a changelog entry:
Fix issue with launching rockets to the moon (#101, #212).