Skip to content

Commit

Permalink
show snapshot disagreements
Browse files Browse the repository at this point in the history
  • Loading branch information
wpbonelli committed Dec 4, 2024
1 parent 1768b52 commit 89e718f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
11 changes: 8 additions & 3 deletions autotest/test_prt_dry.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,9 +372,14 @@ def check_output(idx, test, snapshot):
pls = pd.read_csv(trackcsv_path)
strtpts = pls[pls.ireason == 0]

assert snapshot == pls.drop(["name", "icell"], axis=1).round(2).to_records(
index=False
)
actual = pls.drop(["name", "icell"], axis=1).round(2).reset_index(drop=True)
try:
assert snapshot == actual.to_records(index=False)
except:
snapshot_path = next(iter(k for k in snapshot.session._extensions if name in k))
expected = pd.DataFrame(np.load(snapshot_path)).reset_index(drop=True)
diff = expected.compare(actual)
pytest.fail(diff.to_json())

plot_head = False
if plot_head:
Expand Down
13 changes: 12 additions & 1 deletion autotest/test_prt_voronoi1.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
from prt_test_utils import get_model_name
from shapely.geometry import LineString, Point

# snapshot_path = Path(__file__).parent / "__snapshots__" / __name__ / "test_mf6model"

simname = "prtvor1"
cases = [f"{simname}l2r", f"{simname}welp", f"{simname}weli"]
times = [True, False, False]
Expand Down Expand Up @@ -371,7 +373,16 @@ def check_output(idx, test, snapshot):
# have moved vertically. round for cross-platform error.
# skip macos-14 in CI because grid is slightly different
if not (is_in_ci() and system() == "Darwin" and processor() == "arm"):
assert snapshot == endpts.drop("name", axis=1).round(1).to_records(index=False)
actual = endpts.drop("name", axis=1).round(1).reset_index(drop=True)
try:
assert snapshot == actual.to_records(index=False)
except:
snapshot_path = next(
iter(k for k in snapshot.session._extensions if name in k)
)
expected = pd.DataFrame(np.load(snapshot_path)).reset_index(drop=True)
diff = expected.compare(actual)
pytest.fail(diff.to_json())

# plot results if enabled
plot = False
Expand Down

0 comments on commit 89e718f

Please sign in to comment.