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

461 revert compare images changes #472

Merged
merged 2 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[run]
relative_files = True
5 changes: 4 additions & 1 deletion test/bar/test_bar.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import pytest

from metplotpy.plots.bar import bar
from metcalcpy.compare_images import CompareImages
# from metcalcpy.compare_images import CompareImages

cwd = os.path.dirname(__file__)
CLEANUP_FILES = ['bar.png', 'bar.points1']
Expand Down Expand Up @@ -71,6 +71,7 @@ def test_no_nans_in_points_file(setup, remove_files):
remove_files(cwd, CLEANUP_FILES)


@pytest.mark.skip("fails on linux host machines")
def test_images_match(setup, remove_files):
"""
Compare an expected plot with the
Expand All @@ -82,6 +83,7 @@ def test_images_match(setup, remove_files):
remove_files(cwd, CLEANUP_FILES)


@pytest.mark.skip("fails on linux host machines")
def test_none_data_images_match(setup_nones):
"""
Compare an expected plot with the
Expand Down Expand Up @@ -139,6 +141,7 @@ def test_point_and_plot_files_exist_default(setup_env, remove_files):
remove_files(cwd, check_files)


@pytest.mark.skip("fails on linux host machines")
def test_threshold_plotting(setup_env, remove_files):
"""
Verify that the bar plot using data with thresholds is correct.
Expand Down
3 changes: 2 additions & 1 deletion test/box/test_box.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest
import os
from metplotpy.plots.box import box
from metcalcpy.compare_images import CompareImages
#from metcalcpy.compare_images import CompareImages

cwd = os.path.dirname(__file__)
CLEANUP_FILES = ['box.png', 'box.points1']
Expand All @@ -28,6 +28,7 @@ def test_files_exist(setup, test_input, expected, remove_files):
remove_files(cwd, CLEANUP_FILES)


@pytest.mark.skip("fails on linux hosts")
def test_images_match(setup):
"""
Compare an expected plot with the
Expand Down
4 changes: 2 additions & 2 deletions test/contour/test_contour.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest
import os
from metplotpy.plots.contour import contour
from metcalcpy.compare_images import CompareImages
#from metcalcpy.compare_images import CompareImages

cwd = os.path.dirname(__file__)

Expand Down Expand Up @@ -42,7 +42,7 @@ def test_files_exist(setup, test_input, expected):
assert os.path.isfile(test_input) == expected
cleanup()


@pytest.mark.skip("fails on linux hosts")
def test_images_match(setup):
"""
Compare an expected plots with the
Expand Down
3 changes: 2 additions & 1 deletion test/eclv/test_eclv.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest
import os
from metplotpy.plots.eclv import eclv
from metcalcpy.compare_images import CompareImages
#from metcalcpy.compare_images import CompareImages

cwd = os.path.dirname(__file__)

Expand Down Expand Up @@ -49,6 +49,7 @@ def test_files_exist(setup, test_input, expected):
assert os.path.isfile(test_input) == expected
cleanup()

@pytest.mark.skip("fails on linux hosts")
def test_images_match(setup):
"""
Compare an expected plots with the
Expand Down
4 changes: 2 additions & 2 deletions test/ens_ss/test_ens_ss.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os
import pytest
from metcalcpy.compare_images import CompareImages
#from metcalcpy.compare_images import CompareImages
from metplotpy.plots.ens_ss import ens_ss

cwd = os.path.dirname(__file__)
Expand Down Expand Up @@ -43,7 +43,7 @@ def test_files_exist( setup, test_input, expected):
assert os.path.isfile(test_input) == expected
cleanup()


@pytest.mark.skip("fails on linux hosts")
def test_images_match(setup):
"""
Compare an expected plot with the
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest
import os
from metplotpy.plots.equivalence_testing_bounds import equivalence_testing_bounds as etb
from metcalcpy.compare_images import CompareImages
#from metcalcpy.compare_images import CompareImages

cwd = os.path.dirname(__file__)
CLEANUP_FILES = ['equivalence_testing_bounds.png', 'equivalence_testing_bounds.points1']
Expand Down Expand Up @@ -29,6 +29,7 @@ def test_files_exist(setup, test_input, expected, remove_files):
remove_files(cwd, CLEANUP_FILES)


@pytest.mark.skip("skimage differences causing failure")
def test_images_match(setup, remove_files):
'''
Compare an expected plot with the
Expand Down
4 changes: 2 additions & 2 deletions test/histogram/test_prob_hist.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest
import os
from metplotpy.plots.histogram import prob_hist
from metcalcpy.compare_images import CompareImages
#from metcalcpy.compare_images import CompareImages

cwd = os.path.dirname(__file__)

Expand Down Expand Up @@ -35,7 +35,7 @@ def test_files_exist(setup, test_input, expected):
assert os.path.isfile(f"{cwd}/{test_input}") == expected
cleanup()


@pytest.mark.skip("Image comparisons fail during Github Actions checks.")
def test_images_match(setup):
"""
Compare an expected plot with the
Expand Down
3 changes: 2 additions & 1 deletion test/histogram/test_rank_hist.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest
import os
from metplotpy.plots.histogram import rank_hist
from metcalcpy.compare_images import CompareImages
#from metcalcpy.compare_images import CompareImages

cwd = os.path.dirname(__file__)

Expand Down Expand Up @@ -36,6 +36,7 @@ def test_files_exist(setup, test_input, expected):
cleanup()


@pytest.mark.skip("Image comparisons fail during Github Actions checks.")
def test_images_match(setup):
"""
Compare an expected plot with the
Expand Down
3 changes: 2 additions & 1 deletion test/histogram/test_rel_hist.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest
import os
from metplotpy.plots.histogram import rel_hist
from metcalcpy.compare_images import CompareImages
#from metcalcpy.compare_images import CompareImages

cwd = os.path.dirname(__file__)

Expand Down Expand Up @@ -39,6 +39,7 @@ def test_files_exist(setup, test_input, expected):
cleanup()


@pytest.mark.skip("Image comparisons fail in Github Actions checks.")
def test_images_match(setup):
"""
Compare an expected plot with the
Expand Down
2 changes: 2 additions & 0 deletions test/histogram_2d/test_histogram_2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

from metplotpy.plots.histogram_2d import histogram_2d as h2d

# from metcalcpy.compare_images import CompareImages

cwd = os.path.dirname(__file__)


Expand Down
5 changes: 3 additions & 2 deletions test/hovmoeller/test_hovmoeller.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import pytest
import metplotpy.plots.hovmoeller.hovmoeller as hov
from metplotpy.plots import util
from metcalcpy.compare_images import CompareImages
#from metcalcpy.compare_images import CompareImages

def dict_to_yaml(data_dict,
output_yaml = "test_hovmoeller.yaml"):
Expand All @@ -22,7 +22,8 @@ def cleanup(file_to_remove):
# don't exist. Ignore.
pass

@pytest.mark.skip("Requires specific netCDF input")

@pytest.mark.skip()
def test_default_plot_images_match():
'''
Compare an expected plot with the
Expand Down
4 changes: 2 additions & 2 deletions test/line/test_line_groups_plot.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest
import os
from metplotpy.plots.line import line as l
from metcalcpy.compare_images import CompareImages
#from metcalcpy.compare_images import CompareImages

cwd = os.path.dirname(__file__)

Expand Down Expand Up @@ -47,7 +47,7 @@ def test_files_exist(setup, test_input, expected):
assert os.path.isfile(test_input) == expected
cleanup()


@pytest.mark.skip("fails on linux hosts")
def test_images_match(setup):
'''
Compare an expected plot with the
Expand Down
14 changes: 10 additions & 4 deletions test/line/test_line_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

cwd = os.path.dirname(__file__)

from metcalcpy.compare_images import CompareImages
# from metcalcpy.compare_images import CompareImages


@pytest.fixture
Expand Down Expand Up @@ -147,6 +147,7 @@ def test_no_nans_in_points_files():
pass


@pytest.mark.skip()
def test_images_match(setup):
'''
Compare an expected plot with the
Expand All @@ -163,6 +164,7 @@ def test_images_match(setup):
cleanup()


@pytest.mark.skip()
def test_new_images_match():
'''
Compare an expected plot with the start_at_zero option, with the
Expand Down Expand Up @@ -321,20 +323,21 @@ def test_fixed_var_val():
pass


@pytest.mark.skip("This test currently raises an error on line 81 of line.py. This can"
" probably be fixed be revisiting fbias_fixed_vars_vals.yaml")
@pytest.mark.skip("Image comparison for development only due to differences in hosts")
def test_fixed_var_val_image_compare():
"""
Verify that the fixed_vars_vals_input setting reproduces the
expected plot.

"""
from metcalcpy.compare_images import CompareImages

# Set up the METPLOTPY_BASE so that met_plot.py will correctly find
# the config directory containing all the default config files.
os.environ['METPLOTPY_BASE'] = f"{cwd}/../../"
os.environ['TEST_DIR'] = cwd
custom_config_filename = f"{cwd}/fbias_fixed_vars_vals.yaml"

# Invoke the command to generate a line plot based on
# the custom config file.
l.main(custom_config_filename)
Expand All @@ -346,7 +349,10 @@ def test_fixed_var_val_image_compare():
created_file = os.path.join(cwd, plot_file)

# first verify that the output plot was created
assert os.path.exists(created_file)
if os.path.exists(created_file):
assert True
else:
assert False

comparison = CompareImages(expected_plot, created_file)

Expand Down
3 changes: 2 additions & 1 deletion test/mpr_plot/test_mpr_plot.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest
import os
from metplotpy.plots.mpr_plot import mpr_plot
from metcalcpy.compare_images import CompareImages
#from metcalcpy.compare_images import CompareImages

cwd = os.path.dirname(__file__)
CLEANUP_FILES = ['mpr_plots.png']
Expand Down Expand Up @@ -29,6 +29,7 @@ def test_files_exist(setup, test_input, expected, remove_files):
remove_files(cwd, CLEANUP_FILES)


@pytest.mark.skip("unreliable-sometimes fails due to differences between machines.")
def test_images_match(setup, remove_files):
"""
Compare an expected plot with the
Expand Down
3 changes: 2 additions & 1 deletion test/performance_diagram/test_performance_diagram.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import pytest

from metplotpy.plots.performance_diagram import performance_diagram as pd
from metcalcpy.compare_images import CompareImages
#from metcalcpy.compare_images import CompareImages

cwd = os.path.dirname(__file__)

Expand Down Expand Up @@ -89,6 +89,7 @@ def test_files_exist(setup_env, test_input, expected_bool, remove_files):
pass


@pytest.mark.skip()
def test_images_match(setup, remove_files):
'''
Compare an expected plot with the
Expand Down
3 changes: 2 additions & 1 deletion test/reliability_diagram/test_reliability_diagram.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import pytest
import os
from metplotpy.plots.reliability_diagram import reliability as r
from metcalcpy.compare_images import CompareImages
#from metcalcpy.compare_images import CompareImages

cwd = os.path.dirname(__file__)
CLEANUP_FILES = ['reliability.png', 'reliability.points1']
Expand Down Expand Up @@ -30,6 +30,7 @@ def test_files_exist(setup, test_input, expected, remove_files):
remove_files(cwd, CLEANUP_FILES)


@pytest.mark.skip("depends on machine on which this is run")
def test_images_match(setup, remove_files):
'''
Compare an expected plot with the
Expand Down
3 changes: 2 additions & 1 deletion test/revision_box/test_revision_box.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest
import os
from metplotpy.plots.revision_box import revision_box
from metcalcpy.compare_images import CompareImages
#from metcalcpy.compare_images import CompareImages

cwd = os.path.dirname(__file__)
CLEANUP_FILES = ['revision_box.png', 'revision_box.points1']
Expand Down Expand Up @@ -29,6 +29,7 @@ def test_files_exist(setup, test_input, expected, remove_files):
remove_files(cwd, CLEANUP_FILES)


@pytest.mark.skip("fails on linux hosts")
def test_images_match(setup, remove_files):
"""
Compare an expected plot with the
Expand Down
4 changes: 2 additions & 2 deletions test/revision_series/test_revision_series.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest
import os
from metplotpy.plots.revision_series import revision_series
from metcalcpy.compare_images import CompareImages
#from metcalcpy.compare_images import CompareImages

cwd = os.path.dirname(__file__)
CLEANUP_FILES = ('revision_series.png', 'revision_series.points1')
Expand Down Expand Up @@ -29,7 +29,7 @@ def test_files_exist(setup, test_input, expected, remove_files):
remove_files(cwd, CLEANUP_FILES)


# @pytest.mark.skip("fails on linux hosts")
@pytest.mark.skip("fails on linux hosts")
def test_images_match(setup, remove_files):
"""
Compare an expected plot with the
Expand Down
3 changes: 2 additions & 1 deletion test/roc_diagram/test_roc_diagram.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import os
import pandas as pd
from metplotpy.plots.roc_diagram import roc_diagram as roc
from metcalcpy.compare_images import CompareImages
# from metcalcpy.compare_images import CompareImages
import metcalcpy.util.ctc_statistics as ctc

cwd = os.path.dirname(__file__)
Expand Down Expand Up @@ -209,6 +209,7 @@ def test_ee_returns_empty_df(capsys, remove_files):
remove_files(cwd, ['CTC_ROC_ee.png', 'CTC_ROC_ee.html'])


@pytest.mark.skip("skip image comparison")
def test_images_match(setup, remove_files):
'''
Compare an expected plot with the
Expand Down
1 change: 1 addition & 0 deletions test/scatter/test_scatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ def test_scatter(assert_json_equal):
def test_main():
# check that main can execute without error.
scatter.main()

Loading