Skip to content

Commit

Permalink
Print diff for debugging macos
Browse files Browse the repository at this point in the history
  • Loading branch information
SorooshMani-NOAA committed Jun 21, 2024
1 parent aa821af commit 31a9c28
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from pathlib import Path
import re
from typing import Dict, List
from difflib import context_diff

import pytest

Expand Down Expand Up @@ -68,6 +69,13 @@ def check_reference_directory(
del test_lines[line_index], reference_lines[line_index]

cwd = Path.cwd()
assert '\n'.join(test_lines) == '\n'.join(
reference_lines
), f'"{os.path.relpath(test_filename, cwd)}" != "{os.path.relpath(reference_filename, cwd)}"'

assert '\n'.join(test_lines) == '\n'.join(reference_lines), ''.join(
context_diff(
test_lines,
reference_lines,
fromfile=str(test_filename),
tofile=str(reference_filename),
lineterm='',
)
)

0 comments on commit 31a9c28

Please sign in to comment.