Skip to content

Commit

Permalink
Check that TOOL_SHED_TEST_BROWSER is a valid value
Browse files Browse the repository at this point in the history
  • Loading branch information
nsoranzo committed Oct 10, 2023
1 parent 021932e commit 3d19b73
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/tool_shed/test/functional/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@
Browser,
BrowserContext,
)
from typing_extensions import Literal

from ..base.browser import ShedBrowser
from ..base.playwrightbrowser import PlaywrightShedBrowser
from ..base.twillbrowser import TwillShedBrowser

DEFAULT_BROWSER: Literal["twill", "playwright"] = "playwright"
DEFAULT_BROWSER = "playwright"


def twill_browser() -> Generator[ShedBrowser, None, None]:
Expand All @@ -28,10 +27,13 @@ def playwright_browser(class_context: BrowserContext) -> Generator[ShedBrowser,
yield PlaywrightShedBrowser(page)


if os.environ.get("TOOL_SHED_TEST_BROWSER", DEFAULT_BROWSER) == "twill":
test_browser = os.environ.get("TOOL_SHED_TEST_BROWSER", DEFAULT_BROWSER)
if test_browser == "twill":
shed_browser = pytest.fixture(scope="class")(twill_browser)
else:
elif test_browser == "playwright":
shed_browser = pytest.fixture(scope="class")(playwright_browser)
else:
raise ValueError(f"Unrecognized value for TOOL_SHED_TEST_BROWSER: {test_browser}")


@pytest.fixture(scope="class")
Expand Down

0 comments on commit 3d19b73

Please sign in to comment.