Skip to content

Commit 8cd06e5

Browse files
feat: make TimeoutError extend builtins.TimeoutError (microsoft#2297)
1 parent 38a36bf commit 8cd06e5

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,5 @@ coverage.xml
1818
junit/
1919
htmldocs/
2020
utils/docker/dist/
21+
.venv/
22+
Pipfile*

playwright/_impl/_errors.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
# stable API.
1717

1818

19+
from builtins import TimeoutError as TimeoutErrorBuiltin
1920
from typing import Optional
2021

2122

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

4546

46-
class TimeoutError(Error):
47+
class TimeoutError(Error, TimeoutErrorBuiltin):
4748
pass
4849

4950

tests/async/test_click.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# limitations under the License.
1414

1515
import asyncio
16+
import builtins
1617
from typing import Optional
1718

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

642646

643647
async def test_fail_when_obscured_and_not_waiting_for_hit_target(

0 commit comments

Comments
 (0)