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

ci(plot): add plot option to conftest #2087

Merged
merged 2 commits into from
Dec 3, 2024

Conversation

langevin-usgs
Copy link
Contributor

Many of the autotest scripts have code for plotting results. This PR establishes a convention for passing in a --plot command line option to pytest, which will cause a plot_output() function to be called.

Checklist of items for pull request

  • Replaced section above with description of pull request
  • Added new test or modified an existing test
  • Ran ruff on new and modified python scripts in .doc, autotests, doc, distribution, pymake, and utils subdirectories.
  • Removed checklist items not relevant to this pull request

For additional information see instructions for contributing and instructions for developing.

Copy link
Contributor

@wpbonelli wpbonelli left a comment

Choose a reason for hiding this comment

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

I remember now that the examples are where we've done this most extensively https://github.com/MODFLOW-USGS/modflow6-examples/blob/develop/autotest/conftest.py

maybe these could be provided by devtools, at least write/run/plot which are generally applicable.

@langevin-usgs
Copy link
Contributor Author

Good idea to look into supporting the full suite of write/run/plot. It would be nice to have full control over these. For example, it may be nice to manually modify an input file and then be able to check output and plot. A trick for the modflow6 repo will be how to handle the paths, as the models are written/tested in a pytest temp directory.

@langevin-usgs langevin-usgs merged commit 7f1180f into MODFLOW-USGS:develop Dec 3, 2024
26 checks passed
@langevin-usgs langevin-usgs deleted the feat-pytest-plot branch December 3, 2024 19:04
@mjr-deltares
Copy link
Contributor

This is a nice development, should we at some point ask people to roll this out into 'their' tests, I certainly would like to do that.

@wpbonelli
Copy link
Contributor

@mjr-deltares agreed, yesterday we discussed encouraging people to implement this pattern in their own tests

@langevin-usgs we currently have the --keep option to save a temp dir in a user-specified location — to support the use case you describe, maybe we could consider a --load option which instead of writing the simulation, tries to load the simulation from a specified location?

wpbonelli added a commit that referenced this pull request Dec 6, 2024
Hook PRT tests up to the mechanism introduced in #2087. Adds some duplication where check and plot functions both need the same data, but IMO it's worth it.
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.

3 participants