Skip to content

Commit 61b53f3

Browse files
committed
Make sure app path can be relative
1 parent 37216a2 commit 61b53f3

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

shiny/pytest/_fixture.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,9 @@ def test_more_app_code(page: Page, app: ShinyAppProc):
121121
```
122122
"""
123123

124-
def get_app_path(app: PurePath | str):
124+
def get_app_path(request: pytest.FixtureRequest, app: PurePath | str):
125125
app_purepath_exists = isinstance(app, PurePath) and Path(app).is_file()
126-
app_path = app if app_purepath_exists else Path(app)
126+
app_path = app if app_purepath_exists else request.path.parent / app
127127
return app_path
128128

129129
if isinstance(app, list):
@@ -132,7 +132,7 @@ def get_app_path(app: PurePath | str):
132132
# Will display the app value as a parameter in the logs
133133
@pytest.fixture(scope=scope, params=app)
134134
def fixture_func(request: pytest.FixtureRequest):
135-
app_path = get_app_path(request.param)
135+
app_path = get_app_path(request, request.param)
136136
sa_gen = shiny_app_gen(app_path)
137137
yield next(sa_gen)
138138

@@ -141,7 +141,7 @@ def fixture_func(request: pytest.FixtureRequest):
141141
# No indication of the app value in the logs
142142
@pytest.fixture(scope=scope)
143143
def fixture_func(request: pytest.FixtureRequest):
144-
app_path = get_app_path(app)
144+
app_path = get_app_path(request, app)
145145
sa_gen = shiny_app_gen(app_path)
146146
yield next(sa_gen)
147147

0 commit comments

Comments
 (0)