-
Notifications
You must be signed in to change notification settings - Fork 160
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
Record message_ix version in scenario data & GDX #765
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #765 +/- ##
=====================================
Coverage 95.2% 95.2%
=====================================
Files 46 46
Lines 4312 4335 +23
=====================================
+ Hits 4107 4130 +23
Misses 205 205
|
f930098
to
3f3419d
Compare
@glatterf42 FYI, looking at the recent commits on the branch, I am finding that for some apparently flaky tests, it helps to I think this is because we are using pytest-xdist: where this results in 2+ tests with identical model name and scenario names being run in parallel, then strange effects can occur; for instance, one test reads and sees the result from the GDX file of the other test. (This occurs because message_ix tries to heed users' desire to keep GDX I/O files all in the same directory, rather than separate, temporary directories per-run as the base ixmp GAMSModel class does.)
We could later (no urgency) try this approach to address other apparently flaky tests. |
Very useful catch, would be great to remove some flaky markers :) |
Just rebasing onto current main. |
f56ca4e
to
3f378b2
Compare
- Clone the subject scenario to a unique scenario name, so that GDX I/O cannot collide even when tests are run in parallel. - Rename file: fix typo in file name. - Use snake_case for function name. - Expand parametrized args with distinct names. - Use make_df(). - Remove redundant .set_index(). - Reflow docstring.
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.
LGTM, thanks :)
Rebased after dependabot update to main: are we just seeing flakiness in these tests? |
Looks like flakiness; are we merging regardless and clean up/apply markers later if needed? |
I would say the latter. I have adapted several tests in this PR to ensure they use unique model/scenario names; this means there is no chance that another scenario being run in another pytest-xdist worker thread will try to access the same scenario in the database or in a GDX file. However, this is different from doing a full sweep through the test suite or adapting fixtures to be sure that no test has this fragility. We can do that in a subsequent PR. |
Closes #747.
Housekeeping:
test_equation_NEW_CAPACITY_CONSTRAINT.py::test_new_capacity_up
: fix typo in the file name. Clone the subject scenario to a unique URL, so that GDX I/O files do not collide even if the two test cases are run in parallel.test_integration.py
,test_macro.py
: similarly clone to unique URLs.test_feature_bound_activity_shares.py::test_add_bound_activity_up_all_modes
test_feature_price_emission.py::test_custom_type_variable_periodlength
test_integration::test_multi_db_run
.How to review
Read the diff and note that the CI checks all pass.
PR checklist