Skip to content

Commit 482ace2

Browse files
committed
Use regex and less strict assertion to make test case less likely to
fail due to the race condition.
1 parent 6701d95 commit 482ace2

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

libcloud/test/dns/test_base.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,21 +94,21 @@ def test_export_zone_to_bind_format_success(self):
9494
lines1 = result.split("\n")
9595
lines2 = content.split("\n")
9696

97-
date_str = "{}-{}-{} {}:{}:{}".format(
97+
date_str = r"{}-{}-{} {}:{}:{}".format(
9898
now.year,
9999
zero_pad(now.month),
100100
zero_pad(now.day),
101101
zero_pad(now.hour),
102-
zero_pad(now.minute),
103-
zero_pad(now.second),
102+
r"\d+",
103+
r"\d+",
104104
)
105-
expected_header = "; Generated by Libcloud v{} on {} UTC".format(
105+
expected_header = r"; Generated by Libcloud v{} on {} UTC".format(
106106
__version__,
107107
date_str,
108108
)
109109

110-
self.assertEqual(lines1[0], expected_header)
111-
self.assertEqual(lines2[0], expected_header)
110+
self.assertRegex(lines1[0], expected_header)
111+
self.assertRegex(lines2[0], expected_header)
112112

113113
for lines in [lines1, lines2]:
114114
self.assertEqual(len(lines), 2 + 1 + 9)

0 commit comments

Comments
 (0)