Skip to content

Commit 9a9dcbd

Browse files
committed
Fix issue that caused "PytestAssertRewriteWarning"
1 parent 14e62c4 commit 9a9dcbd

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

seleniumbase/fixtures/base_case.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,13 +198,23 @@ def test_example(self):
198198
Now, if they accidentally type "python", the tests will still run.
199199
Eg. "python my_test.py" instead of "pytest my_test.py"."""
200200
if name == "__main__": # Test called with "python"
201+
import subprocess
201202
from pytest import main as pytest_main
202203
all_args = []
203204
for arg in args:
204205
all_args.append(arg)
205206
for arg in sys.argv[1:]:
206207
all_args.append(arg)
207-
pytest_main([file, "-s", *all_args])
208+
multi = False
209+
for arg in all_args:
210+
if arg.startswith("-n") or arg.startswith("--numprocesses"):
211+
multi = True
212+
if multi:
213+
subprocess.call(
214+
[sys.executable, "-m", "pytest", file, "-s", *all_args]
215+
)
216+
else:
217+
pytest_main([file, "-s", *all_args])
208218

209219
def open(self, url):
210220
"""Navigates the current browser window to the specified page."""

0 commit comments

Comments
 (0)