Skip to content

Commit

Permalink
Merge pull request #14 from mustafakemalgilor/enhancement/fix-adddura…
Browse files Browse the repository at this point in the history
…tion-warning

[unittest] Define _addDuration method to suppress 3.12 warnings
  • Loading branch information
dosaboy authored May 14, 2024
2 parents c58410b + ce35d18 commit 467cca5
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/unit/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,10 @@ def setUp(self):
set_log_level(logging.DEBUG)
else:
set_log_level(logging.INFO)

def _addDuration(self, *args, **kwargs): # For Python >= 3.12
""" Python 3.12 needs subclasses of unittest.TestCase to implement
this in order to record times and execute any cleanup actions once
a test completes regardless of success. Otherwise it emits a warning.
This generic implementation helps suppress it and possibly others in
the future. """

0 comments on commit 467cca5

Please sign in to comment.