Skip to content

Commit

Permalink
Merge pull request #71 from jakelishman/fix-deprecated-datetime-methods
Browse files Browse the repository at this point in the history
Remove use of deprecated `datetime.datetime` methods
  • Loading branch information
mtreinish authored Sep 22, 2023
2 parents 363fa3c + 0d45488 commit 319b70b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ subunit release notes
NEXT (In development)
---------------------

* Removed use of deprecated "utc" and "utcfromtimestamp"
methods of "datetime.datetime". (Jake Lishman)

1.4.3 (2023-09-17)
---------------------

Expand Down
2 changes: 1 addition & 1 deletion python/subunit/test_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def _before_event(self):
time = self._time
if time is not None:
return
time = datetime.datetime.utcnow().replace(tzinfo=iso8601.UTC)
time = datetime.datetime.now(tz=iso8601.UTC)
self.decorated.time(time)

def progress(self, offset, whence):
Expand Down
2 changes: 1 addition & 1 deletion python/subunit/v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
FLAG_MIME_TYPE = 0x0020
FLAG_EOF = 0x0010
FLAG_FILE_CONTENT = 0x0040
EPOCH = datetime.datetime.utcfromtimestamp(0).replace(tzinfo=iso8601.UTC)
EPOCH = datetime.datetime.fromtimestamp(0, tz=iso8601.UTC)
NUL_ELEMENT = b'\0'[0]
# Contains True for types for which 'nul in thing' falsely returns false.
_nul_test_broken = {}
Expand Down

0 comments on commit 319b70b

Please sign in to comment.