Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions tests/mock_vws/test_database_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import base64
import io
import logging
from time import sleep

import pytest
Expand All @@ -22,6 +23,9 @@
)
from tests.mock_vws.utils.assertions import assert_vws_response

LOGGER = logging.getLogger(__name__)
LOGGER.setLevel(logging.DEBUG)


@timeout_decorator.timeout(seconds=500)
def _wait_for_image_numbers(
Expand Down Expand Up @@ -63,15 +67,21 @@ def _wait_for_image_numbers(
while True:
response = database_summary(vuforia_database=vuforia_database)

requirements = {
not_matching_requirements = {
requirement: value
for requirement, value in requirements.items()
if response.json()[requirement] != value
}

if not requirements: # pragma: no cover
if not not_matching_requirements: # pragma: no cover
return

LOGGER.debug('Waiting for database summary.')
LOGGER.debug('Waiting for summary to equal: ')
LOGGER.debug(requirements)
LOGGER.debug('Not matching are:')
LOGGER.debug(not_matching_requirements)

# We wait 0.2 seconds rather than less than that to decrease the number
# of calls made to the API, to decrease the likelihood of hitting the
# request quota.
Expand Down