GitLab is used only for code review, issue tracking and project management. Canonical locations for source code are still and

Commit 74ad2d91 authored by Georg Koppen's avatar Georg Koppen
Browse files

Use freeze_time() in other parts of our tests, too

When using `_relays_with_flags()` and similar methods it's possible
that tests start to hang without time freezing. See bug 33748 for more
details. We work around this by providing the necessary `freeze_time()`
calls meanwhile.
parent 3efb6867
......@@ -3,6 +3,7 @@ import pytest
import os.path
from unittest import mock
from freezegun import freeze_time
from stem import descriptor
from sbws import settings
......@@ -120,6 +121,7 @@ def router_status(server_descriptor, router_statuses):
def relay_list(args, conf, controller):
"""Returns a RelayList containing the Relays in the controller"""
with freeze_time("2020-02-29 10:00:00"):
return relaylist.RelayList(args, conf, controller)
......@@ -71,8 +71,7 @@ def test_increment_recent_measurement_attempt(args, conf, controller):
It also tests that the state file is updated correctly.
state = State(conf['paths']['state_fpath'])
# For this test it does not matter that the consensus timestamps or relays
# are not correct.
with freeze_time("2020-02-29 10:00:00"):
relay_list = RelayList(args, conf, controller=controller, state=state)
# The initial count is 0 and the state does not have that key.
assert 0 == relay_list.recent_measurement_attempt_count
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment