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

Add test-platform fixture for ixmp4 tests #832

Merged
merged 10 commits into from
Mar 8, 2024

Conversation

danielhuppmann
Copy link
Member

@danielhuppmann danielhuppmann commented Mar 7, 2024

Please confirm that this PR has done the following:

  • Tests Added
  • Documentation Added
  • Name of contributors Added to AUTHORS.rst
  • Description in RELEASE_NOTES.md Added

Description of PR

This PR implements a few improvements related to the tests of the ixmp4-integration:

  • Add a test_platform fixture in conftest
  • Add a test for reading default-only runs from ixmp4
  • Drop the "version" column from the meta-indicators when writing to an ixmp4 database (to avoid having a version-meta-indicator and a version-attribute of a Run) and add a test

@danielhuppmann danielhuppmann self-assigned this Mar 7, 2024
@danielhuppmann danielhuppmann marked this pull request as ready for review March 7, 2024 14:19
Copy link

codecov bot commented Mar 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.1%. Comparing base (ddbb88e) to head (6ed7b56).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##            main    #832     +/-   ##
=======================================
+ Coverage   95.0%   95.1%   +0.1%     
=======================================
  Files         64      63      -1     
  Lines       6134    6148     +14     
=======================================
+ Hits        5828    5849     +21     
+ Misses       306     299      -7     

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

Copy link
Contributor

@phackstock phackstock left a 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 in principle.
Just a couple of clarification questions below

pyam/ixmp4.py Show resolved Hide resolved
logger.warning(
"The `meta.version` column was dropped when writing to the ixmp4 platform."
)
meta = df.meta.drop(columns="version")
Copy link
Contributor

Choose a reason for hiding this comment

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

Could this result in an empty data frame except for the model and scenario index?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, added a test-variant for this case

test_df_year.set_meta(1, "version") # add version number added from ixmp4
test_df_year.to_ixmp4(platform=test_platform)

assert "version" not in test_platform.runs.get("model_a", "scen_a").meta
Copy link
Contributor

Choose a reason for hiding this comment

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

Would the meta here just yield nothing?

Copy link
Member Author

Choose a reason for hiding this comment

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

meta yields an empty dictionary here, added a test for it

@danielhuppmann danielhuppmann merged commit b59e77c into IAMconsortium:main Mar 8, 2024
14 checks passed
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