This is an automated email from the ASF dual-hosted git repository.
tomaz pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/libcloud.git
The following commit(s) were added to refs/heads/trunk by this push:
new 482ace27e Use regex and less strict assertion to make test case less
likely to fail due to the race condition.
482ace27e is described below
commit 482ace27e9d730b472f95e44aa380d78b45b0f1c
Author: Tomaz Muraus <[email protected]>
AuthorDate: Mon Aug 14 23:02:23 2023 +0200
Use regex and less strict assertion to make test case less likely to
fail due to the race condition.
---
libcloud/test/dns/test_base.py | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/libcloud/test/dns/test_base.py b/libcloud/test/dns/test_base.py
index 52f28b541..006bb8cd9 100644
--- a/libcloud/test/dns/test_base.py
+++ b/libcloud/test/dns/test_base.py
@@ -94,21 +94,21 @@ class BaseTestCase(unittest.TestCase):
lines1 = result.split("\n")
lines2 = content.split("\n")
- date_str = "{}-{}-{} {}:{}:{}".format(
+ date_str = r"{}-{}-{} {}:{}:{}".format(
now.year,
zero_pad(now.month),
zero_pad(now.day),
zero_pad(now.hour),
- zero_pad(now.minute),
- zero_pad(now.second),
+ r"\d+",
+ r"\d+",
)
- expected_header = "; Generated by Libcloud v{} on {} UTC".format(
+ expected_header = r"; Generated by Libcloud v{} on {} UTC".format(
__version__,
date_str,
)
- self.assertEqual(lines1[0], expected_header)
- self.assertEqual(lines2[0], expected_header)
+ self.assertRegex(lines1[0], expected_header)
+ self.assertRegex(lines2[0], expected_header)
for lines in [lines1, lines2]:
self.assertEqual(len(lines), 2 + 1 + 9)