diff --git a/choreographer/browser_async.py b/choreographer/browser_async.py index 29a36214..b6ea5ab6 100644 --- a/choreographer/browser_async.py +++ b/choreographer/browser_async.py @@ -179,8 +179,9 @@ async def _close(self) -> None: return except ChannelClosedError: _logger.debug("Can send browser.close on close channel") - await asyncio.to_thread(self._channel.close) + if await self._is_closed(wait=2): + return if await self._is_closed(): _logger.debug("Browser is closed after closing channel") diff --git a/choreographer/utils/_kill.py b/choreographer/utils/_kill.py index d7e43442..b2762c76 100644 --- a/choreographer/utils/_kill.py +++ b/choreographer/utils/_kill.py @@ -3,6 +3,10 @@ import platform import subprocess +import logistro + +_logger = logistro.getLogger(__name__) + def kill(process: subprocess.Popen[bytes]) -> None: if platform.system() == "Windows": @@ -13,5 +17,7 @@ def kill(process: subprocess.Popen[bytes]) -> None: ) else: process.terminate() + _logger.info("Called terminate") if process.poll() is None: + _logger.info("Calling kill") process.kill() diff --git a/choreographer/utils/_tmpfile.py b/choreographer/utils/_tmpfile.py index bb9a32f5..23a46f11 100644 --- a/choreographer/utils/_tmpfile.py +++ b/choreographer/utils/_tmpfile.py @@ -193,7 +193,7 @@ def extra_clean() -> None: _logger.info(f"Extra manual clean executing {i}.") self._delete_manually(quiet=True) i += 1 - time.sleep(2) + time.sleep(10) if self.path.exists(): self._delete_manually(quiet=False) diff --git a/tests/conftest.py b/tests/conftest.py index ee8388e3..d57b34fc 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -89,7 +89,7 @@ async def wrapped_test_fn(*args, **kwargs): def pytest_configure(): # change this by command line TODO - pytest.default_timeout = 20 + pytest.default_timeout = 60 # pytest shuts down its capture before logging/threads finish