diff --git a/robot-server/tests/conftest.py b/robot-server/tests/conftest.py index 4105cf765e1..69e9c5576b3 100644 --- a/robot-server/tests/conftest.py +++ b/robot-server/tests/conftest.py @@ -141,8 +141,11 @@ def run_server( "OT_ROBOT_SERVER_DOT_ENV_PATH": "dev.env", "OT_API_CONFIG_DIR": server_temp_directory, }, - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + stdin=subprocess.DEVNULL, + # The server will log to its stdout or stderr. + # Let it inherit our stdout and stderr so pytest captures its logs. + stdout=None, + stderr=None, ) as proc: # Wait for a bit to get started by polling /health from requests.exceptions import ConnectionError diff --git a/robot-server/tests/integration/dev_server.py b/robot-server/tests/integration/dev_server.py index 547d5c442ef..3ad191eedc4 100644 --- a/robot-server/tests/integration/dev_server.py +++ b/robot-server/tests/integration/dev_server.py @@ -54,12 +54,14 @@ def start(self) -> None: "OT_API_CONFIG_DIR": self.server_temp_directory, "OT_ROBOT_SERVER_persistence_directory": self.persistence_directory, }, - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + stdin=subprocess.DEVNULL, + # The server will log to its stdout or stderr. + # Let it inherit our stdout and stderr so pytest captures its logs. + stdout=None, + stderr=None, ) def stop(self) -> None: """Stop the robot server.""" self.proc.send_signal(signal.SIGTERM) - # This calls proc.wait() and does cleanup on stdin, stdout and stderr. - self.proc.__exit__(None, None, None) + self.proc.wait()