Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Andrew/flags #190

Merged
merged 3 commits into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
v1.0.0a11
- Increase wait for checking regular close
- Decrease freeze for manual bad-close cleanup
4 changes: 3 additions & 1 deletion choreographer/browser_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,10 @@ 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):

if await self._is_closed(wait=3):
return

if await self._is_closed():
Expand Down
6 changes: 4 additions & 2 deletions choreographer/browser_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,14 @@ def _close(self) -> None:
try:
self.send_command("Browser.close")
except (BrowserClosedError, BrowserFailedError):
_logger.debug("Browser is closed trying to send Browser.close")
return
except ChannelClosedError:
pass
_logger.debug("Can send browser.close on close channel")

self._channel.close()
if self._is_closed():

if self._is_closed(wait=3):
return

# try kiling
Expand Down
18 changes: 8 additions & 10 deletions choreographer/cli/_cli_utils_no_qa.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import argparse

# import asyncio
import asyncio
import platform
import subprocess
import sys
Expand Down Expand Up @@ -28,8 +27,7 @@ def diagnose() -> None:

logistro.getLogger().setLevel("DEBUG")

# from choreographer import BrowserSync, Browser, browser_which
from choreographer import BrowserSync
from choreographer import Browser, BrowserSync
from choreographer.browsers._chrome_constants import chrome_names
from choreographer.utils._which import browser_which

Expand Down Expand Up @@ -85,15 +83,15 @@ def diagnose() -> None:
fail.append(("Sync test headless", e))
finally:
print("Done with sync test headless".center(50, "*"))
# ruff: noqa: ERA001
# async def test_headless():
# browser = await Browser(debug=True, debug_browser=True, headless=headless)
# await asyncio.sleep(3)
# await browser.close()

async def test_headless() -> None:
browser = await Browser(debug=True, debug_browser=True, headless=headless)
await asyncio.sleep(3)
await browser.close()

try:
print("Async Test Headless".center(50, "*"))
# asyncio.run(test_headless())
asyncio.run(test_headless())
except BaseException as e:
fail.append(("Async test headless", e))
finally:
Expand Down
2 changes: 1 addition & 1 deletion choreographer/utils/_tmpfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(10)
time.sleep(2)
if self.path.exists():
self._delete_manually(quiet=False)

Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ async def wrapped_test_fn(*args, **kwargs):

def pytest_configure():
# change this by command line TODO
pytest.default_timeout = 60
pytest.default_timeout = 20


# pytest shuts down its capture before logging/threads finish
Expand Down