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

feat: make TimeoutError extend builtins.TimeoutError #2297

Merged
merged 3 commits into from
Feb 14, 2024
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ coverage.xml
junit/
htmldocs/
utils/docker/dist/
.venv/
Pipfile*
3 changes: 2 additions & 1 deletion playwright/_impl/_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
# stable API.


from builtins import TimeoutError as TimeoutErrorBuiltin
from typing import Optional


Expand Down Expand Up @@ -43,7 +44,7 @@ def stack(self) -> Optional[str]:
return self._stack


class TimeoutError(Error):
class TimeoutError(Error, TimeoutErrorBuiltin):
pass


Expand Down
4 changes: 4 additions & 0 deletions tests/async/test_click.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

import asyncio
import builtins
from typing import Optional

import pytest
Expand Down Expand Up @@ -638,6 +639,9 @@ async def test_timeout_waiting_for_hit_target(page: Page, server: Server) -> Non
assert "Timeout 5000ms exceeded." in error.message
assert '<div id="blocker"></div> intercepts pointer events' in error.message
assert "retrying click action" in error.message
assert isinstance(error, Error)
assert isinstance(error, TimeoutError)
assert isinstance(error, builtins.TimeoutError)


async def test_fail_when_obscured_and_not_waiting_for_hit_target(
Expand Down
Loading