Skip to content

Commit

Permalink
use os.path.join for connection file path in tests
Browse files Browse the repository at this point in the history
Signed-off-by: Jericho Tolentino <[email protected]>
  • Loading branch information
jericht committed May 2, 2024
1 parent 1169661 commit dff7ee5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def test_run(
):
# GIVEN
caplog.set_level("DEBUG")
conn_dir = "/path/to/conn_dir"
conn_dir = os.path.join(os.sep, "path", "to", "conn_dir")
connection_settings = {"socket": socket_path}
adaptor_runner = Mock()
runner = BackendRunner(adaptor_runner, working_dir=conn_dir)
Expand Down Expand Up @@ -145,7 +145,7 @@ def test_run_raises_when_writing_connection_file_fails(
caplog.set_level("DEBUG")
err = OSError()
open_mock.side_effect = err
conn_dir = "/path/to/conn_dir"
conn_dir = os.path.join(os.sep, "path", "to", "conn_dir")
adaptor_runner = Mock()
runner = BackendRunner(adaptor_runner, working_dir=conn_dir)

Expand Down Expand Up @@ -180,7 +180,7 @@ def test_signal_hook(self, mock_submit, signal_mock: MagicMock) -> None:
# as expected.

# GIVEN
conn_file_path = "/path/to/conn_file"
conn_file_path = os.path.join(os.sep, "path", "to", "conn_file")
adaptor_runner = Mock()
runner = BackendRunner(adaptor_runner, connection_file_path=conn_file_path)
server_mock = MagicMock()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import http.client as http_client
import json
import os
import re
import signal
import subprocess
Expand Down Expand Up @@ -806,7 +807,7 @@ def test_hook(self, signal_mock: MagicMock, cancel_mock: MagicMock) -> None:
# as expected.

# GIVEN
conn_file_path = "/path/to/conn_file"
conn_file_path = os.path.join(os.sep, "path", "to", "conn_file")
runner = FrontendRunner(connection_file_path=conn_file_path)

# WHEN
Expand Down
15 changes: 8 additions & 7 deletions test/openjd/adaptor_runtime/unit/test_entrypoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import argparse
import json
import os
import signal
from pathlib import Path
from typing import Optional
Expand Down Expand Up @@ -468,7 +469,7 @@ def test_runs_background_serve(
):
# GIVEN
init_data = {"init": "data"}
conn_file = "/path/to/conn_file"
conn_file = os.path.join(os.sep, "path", "to", "conn_file")
with patch.object(
runtime_entrypoint.sys,
"argv",
Expand Down Expand Up @@ -514,7 +515,7 @@ def test_background_serve_no_signal_hook(
):
# GIVEN
init_data = {"init": "data"}
conn_file = "/path/to/conn_file"
conn_file = os.path.join(os.sep, "path", "to", "conn_file")
with patch.object(
runtime_entrypoint.sys,
"argv",
Expand Down Expand Up @@ -542,7 +543,7 @@ def test_background_start_raises_when_adaptor_module_not_loaded(
mock_magic_init: MagicMock,
):
# GIVEN
conn_file = "/path/to/conn_file"
conn_file = os.path.join(os.sep, "path", "to", "conn_file")
with patch.object(
runtime_entrypoint.sys,
"argv",
Expand Down Expand Up @@ -583,7 +584,7 @@ def test_runs_background_start(
reentry_exe: Optional[Path],
):
# GIVEN
conn_file = "/path/to/conn_file"
conn_file = os.path.join(os.sep, "path", "to", "conn_file")
with patch.object(
runtime_entrypoint.sys,
"argv",
Expand Down Expand Up @@ -619,7 +620,7 @@ def test_runs_background_stop(
mock_magic_init: MagicMock,
):
# GIVEN
conn_file = "/path/to/conn_file"
conn_file = os.path.join(os.sep, "path", "to", "conn_file")
with patch.object(
runtime_entrypoint.sys,
"argv",
Expand Down Expand Up @@ -649,7 +650,7 @@ def test_runs_background_run(
mock_magic_init: MagicMock,
):
# GIVEN
conn_file = "/path/to/conn_file"
conn_file = os.path.join(os.sep, "path", "to", "conn_file")
run_data = {"run": "data"}
with patch.object(
runtime_entrypoint.sys,
Expand Down Expand Up @@ -683,7 +684,7 @@ def test_background_no_signal_hook(
mock_magic_init: MagicMock,
):
# GIVEN
conn_file = "/path/to/conn_file"
conn_file = os.path.join(os.sep, "path", "to", "conn_file")
run_data = {"run": "data"}
with patch.object(
runtime_entrypoint.sys,
Expand Down

0 comments on commit dff7ee5

Please sign in to comment.