Skip to content

Commit

Permalink
Just always print
Browse files Browse the repository at this point in the history
  • Loading branch information
another-rex committed Aug 9, 2024
1 parent d989639 commit 961e4fc
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions osv/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,32 +116,36 @@ def start_datastore_emulator():
'emulators',
'datastore',
'start',
'--no-store-on-disk',
'--consistency=1.0',
'--host-port=localhost:' + port,
'--project=' + TEST_PROJECT_ID,
'--no-store-on-disk',
],
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)

_wait_for_emulator_ready(proc, 'datastore', _DATASTORE_READY_INDICATOR)
return proc


emulator_stdout_thread_output = ''


def _wait_for_emulator_ready(proc,
emulator,
indicator,
timeout=_EMULATOR_TIMEOUT):
"""Waits for emulator to be ready."""
global emulator_stdout_thread_output
emulator_stdout_thread_output = ''

def _read_thread(proc, ready_event):
"""Thread to continuously read from the process stdout."""
global emulator_stdout_thread_output
ready = False
while True:
line = proc.stdout.readline()
print(line)
if not line:
break
emulator_stdout_thread_output += str(line) + '\n'
Expand All @@ -156,7 +160,6 @@ def _read_thread(proc, ready_event):
thread.start()

if not ready_event.wait(timeout):
print(emulator_stdout_thread_output)
raise RuntimeError(
'{} emulator did not get ready in time.'.format(emulator))

Expand Down

0 comments on commit 961e4fc

Please sign in to comment.