Skip to content

Commit

Permalink
Fixes asserting module path
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonb5 committed Oct 10, 2024
1 parent a5cfc65 commit b54b175
Showing 1 changed file with 10 additions and 18 deletions.
28 changes: 10 additions & 18 deletions CIME/tests/test_unit_system_tests_mvk.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/usr/bin/env python3

import re
import os
import json
import unittest
import tempfile
import contextlib
import sysconfig
from pathlib import Path
from unittest import mock

Expand Down Expand Up @@ -186,12 +186,10 @@ def evv_test_config(case, config):
module = config["20240515_212034_41b5u2"].pop("module")

assert (
re.search(
r"/opt/conda/lib/python.*/site-packages/evv4esm/extensions/kso.py",
module,
)
is not None
f'{sysconfig.get_paths()["purelib"]}/evv4esm/extensions/kso.py'
== module
)

assert config == expected_config

nml_files = [x for x in os.listdir(temp_dir) if x.startswith("user_nl")]
Expand Down Expand Up @@ -386,12 +384,9 @@ def test_testmod_simple(self, evv, find_test_mods):
module = config["20240515_212034_41b5u2"].pop("module")

assert (
re.search(
r"/opt/conda/lib/python.*/site-packages/evv4esm/extensions/ks.py",
module,
)
is not None
f'{sysconfig.get_paths()["purelib"]}/evv4esm/extensions/ks.py' == module
)

assert config == expected_config

nml_files = [x for x in os.listdir(temp_dir) if x.startswith("user_nl")]
Expand Down Expand Up @@ -516,7 +511,7 @@ def test__generate_baseline(self, evv, append_testlog, _generate_baseline):

files = os.listdir(case_baseline_dir)

assert files == ["test1.nc", "test2.nc"]
assert sorted(files) == sorted(["test1.nc", "test2.nc"])

# reset side_effect
case.get_value.side_effect = side_effect
Expand All @@ -528,7 +523,7 @@ def test__generate_baseline(self, evv, append_testlog, _generate_baseline):

files = os.listdir(case_baseline_dir)

assert files == ["test1.nc", "test2.nc"]
assert sorted(files) == sorted(["test1.nc", "test2.nc"])

@mock.patch("CIME.SystemTests.mvk.append_testlog")
@mock.patch("CIME.SystemTests.mvk.evv")
Expand Down Expand Up @@ -603,12 +598,9 @@ def test__compare_baseline(self, evv, append_testlog):
module = config["20240515_212034_41b5u2"].pop("module")

assert (
re.search(
r"/opt/conda/lib/python.*/site-packages/evv4esm/extensions/ks.py",
module,
)
is not None
f'{sysconfig.get_paths()["purelib"]}/evv4esm/extensions/ks.py' == module
)

assert config == expected_config

expected_comments = f"""BASELINE PASS for test '20240515_212034_41b5u2'.
Expand Down

0 comments on commit b54b175

Please sign in to comment.