diff options
| author | LuK1337 <priv.luk@gmail.com> | 2023-09-16 09:36:49 +0200 |
|---|---|---|
| committer | LUCI <gerrit-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2023-09-18 23:59:37 +0000 |
| commit | aadd12cb08bede15946bc790f6005bbe120c17bc (patch) | |
| tree | ec31d207c9a1985171a27bdef48840c46e52bb8d /tests | |
| parent | b8fd19215f59f7f8dbe69528aefca700a2190ecd (diff) | |
| download | git-repo-aadd12cb08bede15946bc790f6005bbe120c17bc.tar.gz | |
Use non-deprecated API for obtaining UTC time
DeprecationWarning: datetime.datetime.utcnow() is deprecated and
scheduled for removal in a future version. Use timezone-aware objects to
represent datetimes in UTC: datetime.datetime.now(datetime.UTC).
Change-Id: Ia2c46fb87c544d98cc2dd68a829f67d4770b479c
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/386615
Tested-by: Łukasz Patron <priv.luk@gmail.com>
Reviewed-by: Mike Frysinger <vapier@google.com>
Reviewed-by: Łukasz Patron <priv.luk@gmail.com>
Commit-Queue: Mike Frysinger <vapier@google.com>
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test_git_superproject.py | 4 | ||||
| -rw-r--r-- | tests/test_git_trace2_event_log.py | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/tests/test_git_superproject.py b/tests/test_git_superproject.py index dc46ec65..600b069f 100644 --- a/tests/test_git_superproject.py +++ b/tests/test_git_superproject.py | |||
| @@ -108,7 +108,9 @@ class SuperprojectTestCase(unittest.TestCase): | |||
| 108 | self.assertRegex(log_entry["sid"], self.FULL_SID_REGEX) | 108 | self.assertRegex(log_entry["sid"], self.FULL_SID_REGEX) |
| 109 | else: | 109 | else: |
| 110 | self.assertRegex(log_entry["sid"], self.SELF_SID_REGEX) | 110 | self.assertRegex(log_entry["sid"], self.SELF_SID_REGEX) |
| 111 | self.assertRegex(log_entry["time"], r"^\d+-\d+-\d+T\d+:\d+:\d+\.\d+Z$") | 111 | self.assertRegex( |
| 112 | log_entry["time"], r"^\d+-\d+-\d+T\d+:\d+:\d+\.\d+\+00:00$" | ||
| 113 | ) | ||
| 112 | 114 | ||
| 113 | def readLog(self, log_path): | 115 | def readLog(self, log_path): |
| 114 | """Helper function to read log data into a list.""" | 116 | """Helper function to read log data into a list.""" |
diff --git a/tests/test_git_trace2_event_log.py b/tests/test_git_trace2_event_log.py index 9d4f24c3..d8e963dd 100644 --- a/tests/test_git_trace2_event_log.py +++ b/tests/test_git_trace2_event_log.py | |||
| @@ -90,7 +90,9 @@ class EventLogTestCase(unittest.TestCase): | |||
| 90 | self.assertRegex(log_entry["sid"], self.FULL_SID_REGEX) | 90 | self.assertRegex(log_entry["sid"], self.FULL_SID_REGEX) |
| 91 | else: | 91 | else: |
| 92 | self.assertRegex(log_entry["sid"], self.SELF_SID_REGEX) | 92 | self.assertRegex(log_entry["sid"], self.SELF_SID_REGEX) |
| 93 | self.assertRegex(log_entry["time"], r"^\d+-\d+-\d+T\d+:\d+:\d+\.\d+Z$") | 93 | self.assertRegex( |
| 94 | log_entry["time"], r"^\d+-\d+-\d+T\d+:\d+:\d+\.\d+\+00:00$" | ||
| 95 | ) | ||
| 94 | 96 | ||
| 95 | def readLog(self, log_path): | 97 | def readLog(self, log_path): |
| 96 | """Helper function to read log data into a list.""" | 98 | """Helper function to read log data into a list.""" |
