You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: shiny/pytest/_fixture.py
+56-8Lines changed: 56 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -34,20 +34,24 @@
34
34
35
35
@no_example()
36
36
defcreate_app_fixture(
37
-
app: Union[PurePath,str],
37
+
app: PurePath|str|list[PurePath|str],
38
38
scope: ScopeName="module",
39
39
):
40
40
"""
41
41
Create a fixture for a local Shiny app directory.
42
42
43
-
Creates a fixture for a local Shiny app that is not contained within the same folder. This fixture is used to start the Shiny app process and return the local URL of the app.
43
+
Creates a fixture for a local Shiny app that is not contained within the same
44
+
folder. This fixture is used to start the Shiny app process and return the local URL
45
+
of the app.
44
46
45
-
If the app path is located in the same directory as the test file, then `create_app_fixture()` can be skipped and `local_app` test fixture can be used instead.
47
+
If the app path is located in the same directory as the test file, then
48
+
`create_app_fixture()` can be skipped and `local_app` test fixture can be used
49
+
instead.
46
50
47
51
Parameters
48
52
----------
49
53
app
50
-
The path to the Shiny app file.
54
+
The path (or a list of paths) to the Shiny app file.
51
55
52
56
If `app` is a `Path` or `PurePath` instance and `Path(app).is_file()` returns
53
57
`True`, then this value will be used directly. Note, `app`'s file path will be
@@ -58,8 +62,14 @@ def create_app_fixture(
58
62
the test function was collected.
59
63
60
64
To be sure that your `app` path is always relative, supply a `str` value.
65
+
66
+
If `app` is a list of path values, then the fixture will be parametrized and each test
67
+
will be run for each path in the list.
61
68
scope
62
-
The scope of the fixture.
69
+
The scope of the fixture. The default is `module`, which means that the fixture
70
+
will be created once per module. See [Pytest fixture
0 commit comments