Skip to content

Conversation

@georgemccabe
Copy link
Contributor

@georgemccabe georgemccabe commented Jan 28, 2026

Change Summary

Test changes

  • Refactor unit tests to write all output to an output directory -- either test/test_output by default (added to .gitignore so files will not be committed to repo) or ${METPLOTPY_TEST_OUTPUT}/test_output if the env var is set. This allows us to review the files generated by the tests and eventually compare them to files generated by previous runs
  • Consolidated redundant test yaml files -- require all points1 files to be written to output directory if they are written
  • Added module-scope fixture to set up test environment to ensure test output directories are removed before running tests
    • module_setup_env sets environment variables TEST_DIR, which is the test subdirectory containing the inputs, e.g. test/bar, and TEST_OUTPUT, which is a directory under the test_output dir that is named after the plot type, e.g. test_output/bar
  • Set METPLOTPY_BASE in test/conftest.py so it doesn't need to be set in each individual test
  • Fix some yaml files for tests that were not being run
  • Removed all CompareImages logic to diff files against _expected.png files. This will be replaced with diffing using METplus diff util against previous runs. I left the _expected.png files in the repo so we can use them to verify that the latest output looks correct.
  • Note: I did not update the following tests, that were skipped, mostly due to the input data not being available in the repo. We can eventually create an input data set that we can make available in the automated tests so these tests can also run.
    • fv3_physics_tend
    • grid_to_grid
    • series_analysis
    • spacetime_plot
    • difficulty_index

Source code changes

  • Fix html path creation to properly handle paths that have .. in them
  • Create directory containing output files (plots and points1) so the writes don't fail when the directory doesn't already exist -- previously these directories were created by the tests
  • Fix crash in _get_show_legend when show_legend is unset -- should raise ValueError instead of null reference
  • Remove logic in histogram_2d for saving points file that does not appear to do anything useful
  • Improve error logging for line plot to log which config variables do not have the same number of items as the number of series
  • Use with to handle open/close of files instead of .close()
  • Fix bug in skew_t plot -- invalid space separator character used when parsing csv
  • Log errors instead of print in wind_rose plot

Note: I ran the METplus diff util on 2 runs to compare the output. As expected, the rank files were flagged with differences (random seed causes different results each run). The html files were also flagged with diffs. We will want to update the METplus diff util logic to allow a user to define the skip keywords and skip extensions so we can use the utility to skip files that should be skipped by the METplotpy tests.

Pull Request Testing

  • Describe testing already performed for these changes:

Ran all pytests and ensured that they passed. Ran METplus diff util on 2 runs to verify that expected files have diffs and the rest do not have any diffs

  • Recommend testing for the reviewer(s) to perform, including the location of input datasets, and any additional instructions:

Review code changes, especially changes to source code.

  • Do these changes include sufficient documentation updates, ensuring that no errors or warnings exist in the build of the documentation? [No]

We should probably add info to the Contributor's Guide to describe how to use $METPLOTPY_TEST_OUTPUT, but I have not done that yet.

  • Do these changes include sufficient testing updates? [Yes]

  • Will this PR result in changes to the test suite? [N/A]

    If yes, describe the new output and/or changes to the existing output:

  • Do these changes introduce new SonarQube findings? [No]

    If yes, please describe:

The quality gate scan fails, but the overall number of open issues has reduced by 7 and the code coverage % increased from 59.3% to 61.3%

  • Please complete this pull request review by 1/30/2026.

Pull Request Checklist

See the METplus Workflow for details.

  • Add any new Python packages to the METplus Components Python Requirements table.
  • Review the source issue metadata (required labels, projects, and milestone).
  • Complete the PR definition above.
  • Ensure the PR title matches the feature or bugfix branch name.
  • Define the PR metadata, as permissions allow.
    Select: Reviewer(s) and Development issue
    Select: Milestone as the version that will include these changes
    Select: Coordinated METplus-X.Y Support project for bugfix releases or METplotpy-X.Y.Z Development project for official releases
  • After submitting the PR, select the ⚙️ icon in the Development section of the right hand sidebar. Search for the issue that this PR will close and select it, if it is not already selected.
  • After the PR is approved, merge your changes. If permissions do not allow this, request that the reviewer do the merge.
  • Close the linked issue and delete your feature or bugfix branch from GitHub.

…TEST_OUTPUT is set) and preserve output files so they can be compared to previous iterations, consolidate redundant tests, use a module fixture to set up environment once per file
…ename to be .html instead of the correct path -- consider moving these functions to the base class, although they will likely be removed when plotly is removed
…e test output directory because plotting functions should now create the directories before writing files, only log that intermed_files directory is being removed if it exists
…el conftest functions -- presume warnings that were supressed here are no longer relevant
… tests, clean up broke yaml files (formatting of show_legend values)
… directory is defined (METplotpy/test or METPLOTPY_TEST_OUTPUT if set) so we can more safely remove the files in the test output directory without risking wiping out user files if METPLOTPY_TEST_OUTPUT is set incorrectly
@georgemccabe georgemccabe added this to the METplotpy-4.0.0 milestone Jan 28, 2026
@georgemccabe georgemccabe requested a review from bikegeek January 28, 2026 17:20
@github-project-automation github-project-automation bot moved this to 🩺 Needs Triage in METplus-7.0 Development Jan 28, 2026
@georgemccabe georgemccabe moved this from 🩺 Needs Triage to 🔎 In review in METplus-7.0 Development Jan 28, 2026
@georgemccabe georgemccabe linked an issue Jan 28, 2026 that may be closed by this pull request
23 tasks
@georgemccabe georgemccabe merged commit cc059df into develop Jan 28, 2026
6 of 7 checks passed
@github-project-automation github-project-automation bot moved this from 🔎 In review to 🏁 Done in METplus-7.0 Development Jan 28, 2026
@georgemccabe georgemccabe deleted the feature_555_test_output branch January 28, 2026 19:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🏁 Done

Development

Successfully merging this pull request may close these issues.

Remove plotly dependency

3 participants