Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

* `selectize`, `remove_button`, and `options` parameters of `ui.input_select()` have been deprecated; use `ui.input_selectize()` instead. (Thanks, @ErdaradunGaztea!) (#1947)

* Added `timeout_secs` parameter to `create_app_fixture` to allow testing apps with longer startup times. (#2033)

### Bug fixes

* Fixed an issue with `ui.Chat()` sometimes wanting to scroll a parent element. (#1996)
Expand Down
7 changes: 5 additions & 2 deletions shiny/pytest/_fixture.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
def create_app_fixture(
app: PurePath | str | list[PurePath | str],
scope: ScopeName = "module",
timeout_secs: float = 30,
):
"""
Create a fixture for a local Shiny app directory.
Expand Down Expand Up @@ -70,6 +71,8 @@ def create_app_fixture(
will be created once per module. See [Pytest fixture
scopes](https://docs.pytest.org/en/stable/how-to/fixtures.html#fixture-scopes)
for more details.
timeout_secs
The maximum number of seconds to wait for the app to become ready.

Returns
-------
Expand Down Expand Up @@ -133,7 +136,7 @@ def get_app_path(request: pytest.FixtureRequest, app: PurePath | str):
@pytest.fixture(scope=scope, params=app)
def fixture_func(request: pytest.FixtureRequest):
app_path = get_app_path(request, request.param)
sa_gen = shiny_app_gen(app_path)
sa_gen = shiny_app_gen(app_path, timeout_secs=timeout_secs)
yield next(sa_gen)

else:
Expand All @@ -142,7 +145,7 @@ def fixture_func(request: pytest.FixtureRequest):
@pytest.fixture(scope=scope)
def fixture_func(request: pytest.FixtureRequest):
app_path = get_app_path(request, app)
sa_gen = shiny_app_gen(app_path)
sa_gen = shiny_app_gen(app_path, timeout_secs=timeout_secs)
yield next(sa_gen)

return fixture_func
Loading