From 71154424866c4d2a66181f12bc1929379a9acb97 Mon Sep 17 00:00:00 2001 From: Thor Whalen <1906276+thorwhalen@users.noreply.github.com> Date: Wed, 14 Oct 2026 00:13:29 +0000 Subject: [PATCH 1/2] Skip selenium e2e helpers at collection when their deps are missing (#24) Co-Authored-By: Claude Sonnet 5.5 --- streamlitfront/tests/conftest.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/streamlitfront/tests/conftest.py b/streamlitfront/tests/conftest.py index 7dccf25..70fbf7e 100644 --- a/streamlitfront/tests/conftest.py +++ b/streamlitfront/tests/conftest.py @@ -1,3 +1,22 @@ +"""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 + +_E2E_MODULES = ("selenium", "webdriver_manager", "strand", "dill", "front") +_E2E_FILES = ("common.py", "use_case_test_old.py") + +collect_ignore = ( + [] + if all(find_spec(name) for name in _E2E_MODULES) + else list(_E2E_FILES) +) + + def pytest_addoption(parser): parser.addoption("--headless", action="store_true", default=False) From 0be61658bdfdd4568d6c51a6393a48343ac59757 Mon Sep 17 00:00:00 2001 From: Thor Whalen <1906276+thorwhalen@users.noreply.github.com> Date: Wed, 14 Oct 2026 00:16:09 +0000 Subject: [PATCH 2/2] Only the selenium e2e deps gate the e2e modules; importable check is error-safe (#24) Co-Authored-By: Claude Sonnet 5.5 --- streamlitfront/tests/conftest.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/streamlitfront/tests/conftest.py b/streamlitfront/tests/conftest.py index 70fbf7e..593bb32 100644 --- a/streamlitfront/tests/conftest.py +++ b/streamlitfront/tests/conftest.py @@ -7,12 +7,21 @@ from importlib.util import find_spec -_E2E_MODULES = ("selenium", "webdriver_manager", "strand", "dill", "front") + +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(find_spec(name) for name in _E2E_MODULES) + if all(map(_importable, _E2E_MODULES)) + and _importable("front.tests.test_use_case") else list(_E2E_FILES) )