-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Labels
bugUh oh... Something needs to be fixedUh oh... Something needs to be fixed
Description
PytestAssertRewriteWarning
if initializing multithreaded tests via python
Steps to reproduce:
Run the the following script with python
: (NOT pytest
directly)
import pytest
from seleniumbase import BaseCase
BaseCase.main(__name__, __file__, "-n4", "-s")
@pytest.mark.parametrize("", [[]] * 4)
def test_multi_threaded(sb):
sb.open("about:blank")
sb.sleep(1)
A warning will appear:
============================== warnings summary ==============================
../../../.virtualenvs/sbase12/lib/python3.12/site-packages/_pytest/config/__init__.py:1204
/Users/michael/.virtualenvs/sbase12/lib/python3.12/site-packages/_pytest/config/__init__.py:1204:
PytestAssertRewriteWarning: Module already imported so cannot be rewritten: seleniumbase
self._mark_plugins_for_rewrite(hook)
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
======================== 4 passed, 1 warning in 3.31s ========================
According to https://stackoverflow.com/a/54666289/7058266, I can use subprocess.call()
instead of pytest.main()
in those situations in order to avoid the warning (where the situation is running multithreaded pytest tests).
Metadata
Metadata
Assignees
Labels
bugUh oh... Something needs to be fixedUh oh... Something needs to be fixed