Skip to content

Commit 96771ad

Browse files
committed
install deps before running the tests
1 parent aaa2ee4 commit 96771ad

File tree

5 files changed

+32
-23
lines changed

5 files changed

+32
-23
lines changed

.github/workflows/pytest.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,9 @@ jobs:
199199
repository: posit-dev/py-shiny-templates
200200
path: py-shiny-templates
201201

202-
- name: Copy py-shiny-templates to examples directory
202+
- name: Install py-shiny-templates dependencies
203203
run: |
204-
cp -r py-shiny-templates/* examples/
204+
make install-py-shiny-templates-deps
205205
206206
- name: Run example app tests
207207
timeout-minutes: 60

Makefile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,13 +220,15 @@ ci-install-wheel: dist FORCE
220220
uv pip install dist/shiny*.whl
221221

222222
install-deps: FORCE ## install dependencies
223-
pip install -e ".[dev,test]" --upgrade
223+
uv pip install -e ".[dev,test]" --upgrade
224224
ci-install-deps: FORCE
225225
uv pip install -e ".[dev,test]"
226+
install-py-shiny-templates-deps: FORCE
227+
uv pip install -r py-shiny-templates/requirements.txt
226228

227229
install-docs: FORCE
228-
pip install -e ".[dev,test,doc]"
229-
pip install https://github.com/posit-dev/py-shinylive/tarball/main
230+
uv pip install -e ".[dev,test,doc]"
231+
uv pip install https://github.com/posit-dev/py-shinylive/tarball/main
230232
ci-install-docs: FORCE
231233
uv pip install -e ".[dev,test,doc]" \
232234
"shinylive @ git+https://github.com/posit-dev/py-shinylive.git"

pyproject.toml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,6 @@ test = [
9191
"dask[dataframe]",
9292
"pyarrow",
9393
"pyarrow-stubs",
94-
"nba_api",
95-
"watchfiles",
96-
"cufflinks",
97-
"yfinance",
98-
"shiny_validate",
99-
"chatlas[anthropic]",
100-
"geopy",
10194

10295
]
10396
dev = [

tests/playwright/examples/example_apps.py

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,13 @@ def get_apps(path: str) -> typing.List[str]:
9898
"examples/brownian": ["Failed to acquire camera feed:"],
9999
}
100100

101+
# Check for Shiny output errors, except for known exception cases
102+
app_allow_output_error = [
103+
"shiny/api-examples/SafeException/app-express.py",
104+
"shiny/api-examples/SafeException/app-core.py",
105+
"examples/global_pyplot/app.py",
106+
]
107+
101108

102109
# Altered from `shinytest2:::app_wait_for_idle()`
103110
# https://github.com/rstudio/shinytest2/blob/b8fdce681597e9610fc078aa6e376134c404f3bd/R/app-driver-wait.R
@@ -254,17 +261,7 @@ def on_console_msg(msg: ConsoleMessage) -> None:
254261
+ "* ".join(console_errors)
255262
)
256263

257-
# Check for Shiny output errors, except for known exception cases
258-
excluded_apps = [
259-
"shiny/api-examples/SafeException/app-express.py",
260-
"shiny/api-examples/SafeException/app-core.py",
261-
"examples/global_pyplot/app.py",
262-
]
263-
if ex_app_path not in excluded_apps:
264-
# Ensure the application is not busy
265-
expect(page.locator(".shiny-busy")).to_have_count(
266-
0, timeout=SHINY_INIT_TIMEOUT
267-
)
264+
if ex_app_path not in app_allow_output_error:
268265
# Ensure there are no output errors present
269266
error_locator = page.locator(".shiny-output-error")
270267
expect(error_locator).to_have_count(0, timeout=ERROR_ELEMENT_TIMEOUT)
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import pytest
2+
from example_apps import get_apps, reruns, reruns_delay, validate_example
3+
from playwright.sync_api import Page
4+
from conftest import here_root
5+
from pathlib import Path
6+
7+
if not Path(here_root / "py-shiny-templates").exists():
8+
pytest.skip(
9+
"./py-shiny-templates dir is not available. Skipping test.",
10+
allow_module_level=True,
11+
)
12+
@pytest.mark.only_browser("chromium")
13+
@pytest.mark.flaky(reruns=reruns, reruns_delay=reruns_delay)
14+
@pytest.mark.parametrize("ex_app_path", get_apps("py-shiny-templates"))
15+
def test_external_templates(page: Page, ex_app_path: str) -> None:
16+
17+
validate_example(page, ex_app_path)

0 commit comments

Comments
 (0)