Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PATCH] Update attrs dependency #12

Merged
merged 10 commits into from
Sep 1, 2022
Merged
Prev Previous commit
Next Next commit
Fix typing in tests
  • Loading branch information
miguelsanchez-eb committed Sep 1, 2022
commit 04b058266747939b96e07aeadfa9a75b9634383f
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def readme():
]

tests_require = [
'freezegun<1.2.0', # We must pin freezegun under 1.2 because newer versions use the tick method differently
'freezegun',
'pytest',
'pytest-cov',
'pytest-runner',
Expand Down
17 changes: 9 additions & 8 deletions tests/unit/recorders/test_default.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
unicode_literals,
)

import datetime
import time
from typing import (
Any,
Expand Down Expand Up @@ -578,11 +579,11 @@ def se():
mock_publish.reset_mock()

recorder.unpublished_metrics_count = 1
frozen_time.tick(9)
frozen_time.tick(datetime.timedelta(seconds=(9)))
recorder.publish_if_full_or_old()
assert mock_publish.call_count == 0

frozen_time.tick(1)
frozen_time.tick(datetime.timedelta(seconds=(1)))
recorder.publish_if_full_or_old()
mock_publish.assert_called_once_with()
mock_publish.reset_mock()
Expand All @@ -591,11 +592,11 @@ def se():
recorder.publish_if_full_or_old()
assert mock_publish.call_count == 0

frozen_time.tick(13)
frozen_time.tick(datetime.timedelta(seconds=(13)))
recorder.publish_if_full_or_old(max_age=14)
assert mock_publish.call_count == 0

frozen_time.tick(1)
frozen_time.tick(datetime.timedelta(seconds=(1)))
recorder.publish_if_full_or_old()
mock_publish.assert_called_once_with()
mock_publish.reset_mock()
Expand All @@ -620,11 +621,11 @@ def se():
recorder.throttled_publish_all()
assert mock_publish.call_count == 0

frozen_time.tick(9)
frozen_time.tick(datetime.timedelta(seconds=(9)))
recorder.throttled_publish_all()
assert mock_publish.call_count == 0

frozen_time.tick(1)
frozen_time.tick(datetime.timedelta(seconds=(1)))
recorder.throttled_publish_all()
mock_publish.assert_called_once_with()
mock_publish.reset_mock()
Expand All @@ -633,11 +634,11 @@ def se():
recorder.throttled_publish_all()
assert mock_publish.call_count == 0

frozen_time.tick(13)
frozen_time.tick(datetime.timedelta(seconds=(13)))
recorder.throttled_publish_all(14)
assert mock_publish.call_count == 0

frozen_time.tick(1)
frozen_time.tick(datetime.timedelta(seconds=(1)))
recorder.throttled_publish_all()
mock_publish.assert_called_once_with()
mock_publish.reset_mock()