Skip to content

Commit 4ee7a0f

Browse files
committed
Maybe this will work
1 parent 1c565b4 commit 4ee7a0f

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

tests/e2e_tests/test_substrate_addons.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,14 @@ def wait_for_output(process, target_string, timeout=60):
2727
bool: True if string was found, False if timeout occurred
2828
"""
2929
import time
30+
3031
start_time = time.time()
3132

3233
# Make stdout non-blocking on Unix systems
33-
if sys.platform != 'win32':
34+
if sys.platform != "win32":
3435
import fcntl
3536
import os
37+
3638
flags = fcntl.fcntl(process.stdout, fcntl.F_GETFL)
3739
fcntl.fcntl(process.stdout, fcntl.F_SETFL, flags | os.O_NONBLOCK)
3840

@@ -42,9 +44,9 @@ def wait_for_output(process, target_string, timeout=60):
4244
# Read available data
4345
chunk = process.stdout.read(1024)
4446
if chunk:
45-
chunk_str = chunk.decode('utf-8', errors='ignore')
47+
chunk_str = chunk.decode("utf-8", errors="ignore")
4648
buffer += chunk_str
47-
print(chunk_str, end='', flush=True) # Echo output for visibility
49+
print(chunk_str, end="", flush=True) # Echo output for visibility
4850

4951
if target_string in buffer:
5052
return True
@@ -60,8 +62,8 @@ def wait_for_output(process, target_string, timeout=60):
6062
# Process ended, read remaining output
6163
remaining = process.stdout.read()
6264
if remaining:
63-
remaining_str = remaining.decode('utf-8', errors='ignore')
64-
print(remaining_str, end='', flush=True)
65+
remaining_str = remaining.decode("utf-8", errors="ignore")
66+
print(remaining_str, end="", flush=True)
6567
if target_string in remaining_str:
6668
return True
6769
return False
@@ -97,7 +99,9 @@ def single_local_chain():
9799
def test_retry_sync_substrate(single_local_chain):
98100
# Wait for the Docker container to be ready
99101
if not wait_for_output(single_local_chain.process, "Imported #1", timeout=60):
100-
raise TimeoutError("Docker container did not start properly - 'Imported #1' not found in output")
102+
raise TimeoutError(
103+
"Docker container did not start properly - 'Imported #1' not found in output"
104+
)
101105

102106
with RetrySyncSubstrate(
103107
single_local_chain.uri, fallback_chains=[LATENT_LITE_ENTRYPOINT]
@@ -111,16 +115,13 @@ def test_retry_sync_substrate(single_local_chain):
111115
time.sleep(2)
112116

113117

114-
@pytest.mark.skip(
115-
"There's an issue with this running in the GitHub runner, "
116-
"where it seemingly cannot connect to the docker container. "
117-
"It does run locally, however."
118-
)
119118
def test_retry_sync_substrate_max_retries(docker_containers):
120119
# Wait for both Docker containers to be ready
121120
for i, container in enumerate(docker_containers):
122121
if not wait_for_output(container.process, "Imported #1", timeout=60):
123-
raise TimeoutError(f"Docker container {i} did not start properly - 'Imported #1' not found in output")
122+
raise TimeoutError(
123+
f"Docker container {i} did not start properly - 'Imported #1' not found in output"
124+
)
124125

125126
with RetrySyncSubstrate(
126127
docker_containers[0].uri, fallback_chains=[docker_containers[1].uri]

0 commit comments

Comments
 (0)