Skip to content

Commit 7accc74

Browse files
committed
Updating monkeypatch
1 parent 35f5365 commit 7accc74

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

tests/pytest/test_main.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import os
21
import warnings
32
from typing import Any, Dict
43

@@ -7,16 +6,16 @@
76
from shiny._main import _set_workbench_kwargs
87

98

10-
def test_workbench_kwargs_if_url_set():
9+
def test_workbench_kwargs_if_url_set(monkeypatch: pytest.MonkeyPatch):
1110
"""
1211
Test that the `ws_per_message_deflate` kwarg is set to False when
1312
RS_SERVER_URL and RS_SESSION_URL are set in the environment.
1413
This is to avoid breaking issues in Workbench.
1514
If the kwargs are set to True, a warning is raised and the value is set to False.
1615
"""
1716
# Workbench URL is set, kwargs are not
18-
os.environ["RS_SERVER_URL"] = "any_string"
19-
os.environ["RS_SESSION_URL"] = "any_string"
17+
monkeypatch.setenv("RS_SERVER_URL", "any_string")
18+
monkeypatch.setenv("RS_SESSION_URL", "any_string")
2019

2120
kwargs: Dict[str, Any] = {}
2221
_set_workbench_kwargs(kwargs)
@@ -35,10 +34,6 @@ def test_workbench_kwargs_if_url_set():
3534
_set_workbench_kwargs(kwargs)
3635
assert kwargs.get("ws_per_message_deflate") is False
3736

38-
# Teardown
39-
del os.environ["RS_SERVER_URL"]
40-
del os.environ["RS_SESSION_URL"]
41-
4237

4338
def test_workbench_kwargs_if_url_not_set():
4439
"""

0 commit comments

Comments
 (0)