Skip to content

Commit f33c71b

Browse files
Merge pull request #464 from adamtheturtle/log-wait-for
Add stricter requirements to the database summary test and add logging
2 parents 30ed9d8 + 91cfc76 commit f33c71b

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

tests/mock_vws/test_database_summary.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import base64
66
import io
7+
import logging
78
from time import sleep
89

910
import pytest
@@ -22,6 +23,9 @@
2223
)
2324
from tests.mock_vws.utils.assertions import assert_vws_response
2425

26+
LOGGER = logging.getLogger(__name__)
27+
LOGGER.setLevel(logging.DEBUG)
28+
2529

2630
@timeout_decorator.timeout(seconds=500)
2731
def _wait_for_image_numbers(
@@ -63,15 +67,21 @@ def _wait_for_image_numbers(
6367
while True:
6468
response = database_summary(vuforia_database=vuforia_database)
6569

66-
requirements = {
70+
not_matching_requirements = {
6771
requirement: value
6872
for requirement, value in requirements.items()
6973
if response.json()[requirement] != value
7074
}
7175

72-
if not requirements: # pragma: no cover
76+
if not not_matching_requirements: # pragma: no cover
7377
return
7478

79+
LOGGER.debug('Waiting for database summary.')
80+
LOGGER.debug('Waiting for summary to equal: ')
81+
LOGGER.debug(requirements)
82+
LOGGER.debug('Not matching are:')
83+
LOGGER.debug(not_matching_requirements)
84+
7585
# We wait 0.2 seconds rather than less than that to decrease the number
7686
# of calls made to the API, to decrease the likelihood of hitting the
7787
# request quota.

0 commit comments

Comments
 (0)