Skip to content

Commit

Permalink
✅ Pass test
Browse files Browse the repository at this point in the history
  • Loading branch information
yhs0602 committed Feb 8, 2025
1 parent 33ff614 commit 10297cc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/craftground/environment/socket_ipc.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,3 +214,4 @@ def _connect_server(self, server_event: threading.Event):
raise Exception("Server not started within 1024 seconds")
wait_time += 1
time.sleep(1)
raise RuntimeError("Minecraft process failed to start")
8 changes: 5 additions & 3 deletions tests/python/unit/test_environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,18 @@ def test_initialize_boost_environment(mock_ipc_class, mock_initial_env):

@patch("socket.socket")
@patch("subprocess.Popen")
def test_start_server(mock_popen, mock_socket, environment):
def test_reset(mock_popen, mock_socket, environment):
mock_process = MagicMock()
mock_popen.return_value = mock_process
mock_sock_instance = MagicMock()
mock_socket.return_value = mock_sock_instance

environment.start_server(seed=1234)
with pytest.raises(RuntimeError):
environment.reset(seed=1234)

assert mock_popen.called
assert environment.process is not None
# assert mock_socket.called
# assert environment.process is not None


@patch("builtins.open", new_callable=MagicMock)
Expand Down

0 comments on commit 10297cc

Please sign in to comment.