Skip to content

Commit cd4b0d4

Browse files
Thibault-Pelletierjourdain
authored andcommitted
fix(test): fix test helpers for Windows
* Use full current python path when running Selenium server python process * Fix port parsing in xprocess logs for Windows * Add option to disable log prints to avoid test clutter
1 parent 15c968d commit cd4b0d4

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

trame_client/utils/testing.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import json
2+
import sys
23
from pathlib import Path
34
from xprocess import ProcessStarter
45
from PIL import Image
@@ -11,17 +12,19 @@
1112

1213

1314
class TrameServerMonitor:
14-
def __init__(self, log_path):
15+
def __init__(self, log_path, do_print_log_lines=False):
1516
self._log_path = log_path
1617
self._last_state = {}
1718
self.port = 0
19+
self.do_print_log_lines = do_print_log_lines
1820
self.update()
1921

2022
def update(self):
2123
last_state_line = "STATE: {}"
2224
with open(self._log_path, "r") as f:
2325
for line in f.readlines():
24-
print(line)
26+
if self.do_print_log_lines:
27+
print(line)
2528
if "SERVER_PORT:" in line:
2629
self.port = int(line[13:])
2730
if line[:7] == "STATE: ":
@@ -69,7 +72,7 @@ class Starter(ProcessStarter):
6972

7073
# command to start process
7174
args = [
72-
"python3",
75+
Path(sys.executable).as_posix(),
7376
str(self.root_path / server_path),
7477
"--server",
7578
"--host",

0 commit comments

Comments
 (0)