Skip to content

Commit d4ee749

Browse files
committed
Add timeout_test to demonstrate test timeouts
1 parent 1e5af01 commit d4ee749

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

examples/timeout_test.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
""" This test fails on purpose to demonstrate the timeout feature
2+
for tests that run longer than the time limit specified. """
3+
4+
import pytest
5+
import time
6+
from seleniumbase import BaseCase
7+
8+
9+
class MyTestClass(BaseCase):
10+
11+
@pytest.mark.expected_failure
12+
@pytest.mark.timeout(6) # The test will fail if it runs longer than this
13+
def test_timeout_failure(self):
14+
self.open("https://xkcd.com/1658/")
15+
time.sleep(7)

0 commit comments

Comments
 (0)