Skip to content

Commit ebec788

Browse files
committed
Remove pytest-timeout (not thread-safe) and prevent use
1 parent aa51386 commit ebec788

File tree

4 files changed

+20
-3
lines changed

4 files changed

+20
-3
lines changed

requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ pytest-html==2.0.1;python_version>="3.6"
2222
pytest-metadata>=1.8.0
2323
pytest-ordering>=0.6
2424
pytest-rerunfailures>=8.0
25-
pytest-timeout>=1.3.4
2625
pytest-xdist>=1.31.0
2726
parameterized>=0.7.1
2827
soupsieve==1.9.5

seleniumbase/plugins/base_plugin.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,28 @@ def options(self, parser, env):
7777
default=False,
7878
help="If true when using report, will display it after tests run.")
7979
found_processes_arg = False
80+
found_timeout_arg = False
8081
for arg in sys.argv:
8182
if "--processes=" in arg:
8283
found_processes_arg = True
84+
if "--timeout=" in arg:
85+
found_timeout_arg = True
8386
if found_processes_arg:
8487
print("* WARNING: Don't use multi-threading with nosetests! *")
8588
parser.add_option(
86-
'--processes', dest='processes',
89+
'--processes',
90+
dest='processes',
8791
default=0,
8892
help="WARNING: Don't use multi-threading with nosetests!")
93+
if found_timeout_arg:
94+
print("\n WARNING: Don't use --timeout=s from pytest-timeout!")
95+
print(" It's not thread-safe for WebDriver processes!")
96+
print(" Use --time-limit=s from SeleniumBase instead!\n")
97+
parser.add_option(
98+
'--timeout',
99+
dest='timeout',
100+
default=0,
101+
help="Don't use --timeout=s! Use --time-limit=s instead!")
89102

90103
def configure(self, options, conf):
91104
super(Base, self).configure(options, conf)

seleniumbase/plugins/pytest_plugin.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,12 @@ def pytest_addoption(parser):
349349
help="""Setting this overrides the default timeout
350350
by the multiplier when waiting for page elements.
351351
Unused when tests overide the default value.""")
352+
for arg in sys.argv:
353+
if "--timeout=" in arg:
354+
raise Exception(
355+
"\n\n Don't use --timeout=s from pytest-timeout! "
356+
"\n It's not thread-safe for WebDriver processes! "
357+
"\n Use --time-limit=s from SeleniumBase instead!\n")
352358

353359

354360
def pytest_configure(config):

setup.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@
104104
'pytest-metadata>=1.8.0',
105105
'pytest-ordering>=0.6',
106106
'pytest-rerunfailures>=8.0',
107-
'pytest-timeout>=1.3.4',
108107
'pytest-xdist>=1.31.0',
109108
'parameterized>=0.7.1',
110109
'soupsieve==1.9.5',

0 commit comments

Comments
 (0)