Skip to content

Commit

Permalink
Merge pull request #1372 from Dominik-Vogel/fix_flaky_test_subscription
Browse files Browse the repository at this point in the history
Fix flaky `test_basic_subscription`
  • Loading branch information
Dominik-Vogel authored Nov 5, 2018
2 parents 68f45cd + b89d887 commit c5ccf3c
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions qcodes/tests/dataset/test_subscribing.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
# pylint: enable=unused-import

from qcodes.tests.test_config import default_config
from qcodes.tests.common import retry_until_does_not_throw


log = logging.getLogger(__name__)
Expand Down Expand Up @@ -135,12 +136,20 @@ def test_subscription_from_config(dataset, basic_subscriber):

expected_state = {}

for x in range(10):
# Here we are only testing 2 to reduce the CI time
for x in range(2):
y = -x**2
dataset.add_result({'x': x, 'y': y})
expected_state[x+1] = [(x, y)]
assert dataset.subscribers[sub_id].state == expected_state
assert dataset.subscribers[sub_id_c].state == expected_state

@retry_until_does_not_throw(
exception_class_to_expect=AssertionError, delay=0, tries=10)
def assert_expected_state():
assert dataset.subscribers[sub_id].state == expected_state
assert dataset.subscribers[sub_id_c].state == expected_state

assert_expected_state()


def test_subscription_from_config_wrong_name(dataset):
"""
Expand Down

0 comments on commit c5ccf3c

Please sign in to comment.