Skip to content

Commit 9c0e709

Browse files
committed
Better start_grpc_server check
1 parent 35fc799 commit 9c0e709

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

Browser/playwright.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,6 @@
4242
from .utils import PlaywrightLogTypes, find_free_port, logger
4343

4444

45-
def _run_grpc_server() -> bool:
46-
return start_grpc_server is not None
47-
48-
4945
class Playwright(LibraryComponent):
5046
"""A wrapper for communicating with nodejs Playwright process."""
5147

@@ -80,7 +76,7 @@ def ensure_node_dependencies(self):
8076
8177
If BrowserBatteries is installed, does nothing.
8278
"""
83-
if _run_grpc_server():
79+
if start_grpc_server is not None:
8480
logger.trace(
8581
"Running gRPC server from BrowserBatteries, no need to check node"
8682
)
@@ -136,9 +132,9 @@ def start_playwright(self) -> Optional[Popen]:
136132
logfile = self.playwright_log.open("w", encoding="utf-8")
137133
else:
138134
logfile = Path(os.devnull).open("w", encoding="utf-8") # noqa: SIM115
139-
if _run_grpc_server():
140-
return start_grpc_server(logfile)
141-
return self._start_playwright_from_node(logfile)
135+
if start_grpc_server is None:
136+
return self._start_playwright_from_node(logfile)
137+
return start_grpc_server(logfile)
142138

143139
def _start_playwright_from_node(self, logfile: TextIOWrapper) -> Popen:
144140
"""Start Playwright from nodejs wrapper."""

0 commit comments

Comments
 (0)