Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions streamlitfront/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,31 @@
"""Pytest configuration for the in-package tests.

``common.py`` and ``use_case_test_old.py`` drive a real browser through selenium; they
cannot even be imported without the optional e2e dependencies (``tests/test_requirements.txt``),
so they are left out of collection when those are missing instead of breaking it.
"""

from importlib.util import find_spec


def _importable(name: str) -> bool:
try:
return find_spec(name) is not None
except ImportError: # a parent package is missing
return False


_E2E_MODULES = ("selenium", "webdriver_manager", "strand")
_E2E_FILES = ("common.py", "use_case_test_old.py")

collect_ignore = (
[]
if all(map(_importable, _E2E_MODULES))
and _importable("front.tests.test_use_case")
else list(_E2E_FILES)
)


def pytest_addoption(parser):
parser.addoption("--headless", action="store_true", default=False)

Expand Down
Loading