Skip to content

Commit

Permalink
Get the __file__ info from request in fixture
Browse files Browse the repository at this point in the history
  • Loading branch information
schloerke committed Jan 30, 2024
1 parent dd80734 commit 67d2e49
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 14 deletions.
2 changes: 1 addition & 1 deletion tests/playwright/deploys/plotly/test_plotly_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from utils.deploy_utils import create_deploys_app_url_fixture, skip_if_not_chrome

TIMEOUT = 2 * 60 * 1000
app_url = create_deploys_app_url_fixture(__file__, "example_deploy_app_A")
app_url = create_deploys_app_url_fixture("example_deploy_app_A")


@skip_if_not_chrome
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from playwright.sync_api import Page
from utils.deploy_utils import create_deploys_app_url_fixture, skip_if_not_chrome

app_url = create_deploys_app_url_fixture(__file__, "shiny_express_accordion")
app_url = create_deploys_app_url_fixture("shiny_express_accordion")


@skip_if_not_chrome
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from playwright.sync_api import Page
from utils.deploy_utils import create_deploys_app_url_fixture, skip_if_not_chrome

app_url = create_deploys_app_url_fixture(__file__, "shiny-express-dataframe")
app_url = create_deploys_app_url_fixture("shiny-express-dataframe")


@skip_if_not_chrome
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from playwright.sync_api import Page, expect
from utils.deploy_utils import create_deploys_app_url_fixture, skip_if_not_chrome

app_url = create_deploys_app_url_fixture(__file__, "shiny-express-folium")
app_url = create_deploys_app_url_fixture("shiny-express-folium")


@skip_if_not_chrome
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

TIMEOUT = 2 * 60 * 1000

app_url = create_deploys_app_url_fixture(__file__, "shiny-express-folium")
app_url = create_deploys_app_url_fixture("shiny-express-folium")


@skip_if_not_chrome
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from playwright.sync_api import Page
from utils.deploy_utils import create_deploys_app_url_fixture, skip_if_not_chrome

app_url = create_deploys_app_url_fixture(__file__, "express_page_fillable")
app_url = create_deploys_app_url_fixture("express_page_fillable")


@skip_if_not_chrome
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from playwright.sync_api import Page
from utils.deploy_utils import create_deploys_app_url_fixture, skip_if_not_chrome

app_url = create_deploys_app_url_fixture(__file__, "express_page_fluid")
app_url = create_deploys_app_url_fixture("express_page_fluid")


@skip_if_not_chrome
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from shiny import ui
from shiny.express import ui as xui

app_url = create_deploys_app_url_fixture(__file__, "express_page_sidebar")
app_url = create_deploys_app_url_fixture("express_page_sidebar")


@skip_if_not_chrome
Expand Down
7 changes: 1 addition & 6 deletions tests/playwright/utils/deploy_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,17 +163,12 @@ def deploy_app(


def create_deploys_app_url_fixture(
test_file_path: str, # __file__
app_name: str,
scope: ScopeName = "module",
):
app_file = os.path.join(
os.path.dirname(os.path.abspath(test_file_path)),
"app.py",
)

@pytest.fixture(scope=scope, params=[*deploy_locations, LOCAL_LOCATION])
def fix_fn(request: pytest.FixtureRequest):
app_file = os.path.join(os.path.dirname(request.path), "app.py")
deploy_location = request.param

if deploy_location == LOCAL_LOCATION:
Expand Down

0 comments on commit 67d2e49

Please sign in to comment.