Skip to content

Commit 9e20f31

Browse files
committed
little fix for testing docker
1 parent 67a7fe9 commit 9e20f31

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

tests/book_tester.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,13 @@ def strip_screenshot_timestamps(output):
176176
fixed = re.sub(r"^\d\d\.html$", "XX.html", fixed, flags=re.MULTILINE)
177177
return fixed
178178

179+
def strip_docker_image_ids_and_creation_times(output):
180+
fixed = re.sub(
181+
r"superlists\s+latest\s+\w+\s+\d+ \w+ ago\s+164MB",
182+
r"superlists latest someidorother X time ago 164MB",
183+
output,
184+
)
185+
return fixed
179186

180187
SQLITE_MESSAGES = {
181188
"django.db.utils.IntegrityError: lists_item.list_id may not be NULL": "django.db.utils.IntegrityError: NOT NULL constraint failed: lists_item.list_id",
@@ -382,6 +389,7 @@ def assert_console_output_correct(self, actual, expected, ls=False):
382389
actual_fixed = strip_object_ids(actual_fixed)
383390
actual_fixed = strip_migration_timestamps(actual_fixed)
384391
actual_fixed = strip_session_ids(actual_fixed)
392+
actual_fixed = strip_docker_image_ids_and_creation_times(actual_fixed)
385393
actual_fixed = strip_localhost_port(actual_fixed)
386394
actual_fixed = strip_screenshot_timestamps(actual_fixed)
387395
actual_fixed = fix_sqlite_messages(actual_fixed)
@@ -398,6 +406,9 @@ def assert_console_output_correct(self, actual, expected, ls=False):
398406
expected_fixed = strip_bdd_test_speed(expected_fixed)
399407
expected_fixed = strip_git_hashes(expected_fixed)
400408
expected_fixed = strip_mock_ids(expected_fixed)
409+
print('fixing', expected_fixed)
410+
expected_fixed = strip_docker_image_ids_and_creation_times(expected_fixed)
411+
print('fixed ', expected_fixed)
401412
expected_fixed = strip_object_ids(expected_fixed)
402413
expected_fixed = strip_migration_timestamps(expected_fixed)
403414
expected_fixed = strip_session_ids(expected_fixed)

tests/test_book_tester.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -598,6 +598,15 @@ def test_only_ignores_exactly_32_char_strings_no_whitespace(self):
598598
self.assert_console_output_correct(actual + "1", expected + "a")
599599
self.assert_console_output_correct(" " + actual, " " + expected)
600600

601+
def test_ignores_docker_image_ids_and_creation_time(self):
602+
actual = "superlists latest 522824a399de 2 weeks ago 164MB"
603+
expected = Output("superlists latest 522824a399de 2 minutes ago 164MB")
604+
self.assert_console_output_correct(actual, expected)
605+
self.assertTrue(expected.was_checked)
606+
with self.assertRaises(AssertionError):
607+
bad_actual = "geoff latest 522824a399de 2 weeks ago 164MB"
608+
self.assert_console_output_correct(bad_actual, expected)
609+
601610
def test_ignores_screenshot_times(self):
602611
actual = (
603612
"screenshotting to ...goat-book/functional_tests/screendumps/MyListsTes\n"

0 commit comments

Comments
 (0)