Skip to content

Commit 0045b40

Browse files
authored
Add pauses and log repeats to avoid issues with detecting test completion on iOS/macOS. (#111)
A some strategic pauses on macOS and iOS to avoid missing test results.
1 parent c00eb5c commit 0045b40

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

tests/testbed.py

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import os
2+
import sys
23
import tempfile
4+
import time
35
from pathlib import Path
46

57
import pytest
@@ -23,10 +25,30 @@ def run_tests():
2325
]
2426
)
2527

26-
print(f">>>>>>>>>> EXIT {returncode} <<<<<<<<<<")
28+
# On iOS and macOS, Briefcase needs to use a log streamer. However, this
29+
# streamer can drop lines of test output due to system load. If the log
30+
# result sentinel isn't seen in streamed output, the test will fail because
31+
# the exit status of the test isn't known. As a safety measure on iOS and
32+
# macOS, output the log sentinel multiple times to decrease the chance of
33+
# this happening.
34+
if sys.platform in {"darwin", "ios"}:
35+
for i in range(0, 6):
36+
time.sleep(0.5)
37+
print(f">>>>>>>>>> EXIT {returncode} <<<<<<<<<<")
38+
else:
39+
print(f">>>>>>>>>> EXIT {returncode} <<<<<<<<<<")
2740

2841

2942
if __name__ == "__main__":
43+
# On iOS and macOS, Briefcase needs to use a log streamer. However, this
44+
# streamer takes time to start up. As a safety measure, wait a couple of seconds
45+
# at app start, and output some lines to minimize the impact of the streamer
46+
# startup.
47+
if sys.platform in {"darwin", "ios"}:
48+
print("Waiting for log streamer...")
49+
time.sleep(2.0)
50+
print("Log streamer should be ready.")
51+
3052
# Run the app main to stimulate app creation and logging of test conditions.
3153
app_main()
3254
# Run the actual test suite.

0 commit comments

Comments
 (0)