Skip to content

Commit 439fedd

Browse files
committed
add new __main__ module tests
1 parent 27a856c commit 439fedd

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

tests/test_main.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,15 @@ def test_main_include_exclude_defined_simultaneously(capsys):
9292
# Unified diff integration tests
9393
#
9494

95+
def test_main_run_unified_default_local_files_no_diff(capsys):
96+
"""Test default behavior when there is no difference in font files under evaluation"""
97+
args = [ROBOTO_BEFORE_PATH, ROBOTO_BEFORE_PATH]
98+
99+
run(args)
100+
captured = capsys.readouterr()
101+
assert captured.out == f"[*] There is no difference between the files.{os.linesep}"
102+
103+
95104
def test_main_run_unified_default_local_files(capsys):
96105
args = [ROBOTO_BEFORE_PATH, ROBOTO_AFTER_PATH]
97106

@@ -113,6 +122,27 @@ def test_main_run_unified_default_local_files(capsys):
113122
assert line == expected_string_list[x]
114123

115124

125+
def test_main_run_unified_local_files_without_mp_optimizations(capsys):
126+
args = ["--nomp", ROBOTO_BEFORE_PATH, ROBOTO_AFTER_PATH]
127+
128+
run(args)
129+
captured = capsys.readouterr()
130+
131+
res_string_list = captured.out.split("\n")
132+
expected_string_list = ROBOTO_UDIFF_EXPECTED.split("\n")
133+
134+
# have to handle the tests for the top two file path lines
135+
# differently than the rest of the comparisons because
136+
# the time is defined using local platform settings
137+
# which makes tests fail on different remote CI testing services
138+
for x, line in enumerate(res_string_list):
139+
# treat top two lines of the diff as comparison of first 10 chars only
140+
if x in (0, 1):
141+
assert line[0:9] == expected_string_list[x][0:9]
142+
else:
143+
assert line == expected_string_list[x]
144+
145+
116146
def test_main_run_unified_default_remote_files(capsys):
117147
args = [ROBOTO_BEFORE_URL, ROBOTO_AFTER_URL]
118148

0 commit comments

Comments
 (0)