async def test_close(self, mock_interaction_server: interaction_server_impl.InteractionServer):
        mock_runner = mock.AsyncMock()
        mock_event = mock.Mock()
        mock_interaction_server._is_closing = False
        mock_interaction_server._server = mock_runner
        mock_interaction_server._close_event = mock_event

        await mock_interaction_server.close()

        mock_runner.shutdown.assert_awaited_once()
        mock_runner.cleanup.assert_awaited_once()
        mock_event.set.assert_called_once()
        assert mock_interaction_server._is_closing is True
    async def test_close_when_closing(self, mock_interaction_server: interaction_server_impl.InteractionServer):
        mock_runner = mock.AsyncMock()
        mock_event = mock.Mock()
        mock_interaction_server._server = mock_runner
        mock_interaction_server._close_event = mock_event
        mock_interaction_server._is_closing = True
        mock_interaction_server.join = mock.AsyncMock()

        await mock_interaction_server.close()

        mock_runner.shutdown.assert_not_called()
        mock_runner.cleanup.assert_not_called()
        mock_event.set.assert_not_called()
        mock_interaction_server.join.assert_awaited_once()
    async def test_start_when_already_running(self, mock_interaction_server: interaction_server_impl.InteractionServer):
        mock_interaction_server._server = object()

        with pytest.raises(errors.ComponentStateConflictError):
            await mock_interaction_server.start()
    def test_is_alive_property_when_active(self, mock_interaction_server: interaction_server_impl.InteractionServer):
        mock_interaction_server._server = object()

        assert mock_interaction_server.is_alive is True