Skip to content

Commit 521850c

Browse files
[Async] Apply #2290 to async code
1 parent 0533097 commit 521850c

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

test/unit/aio/test_connection_async_unit.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,13 +196,25 @@ async def test_partner_env_var(mock_post_requests):
196196
)
197197

198198

199-
async def test_imported_module(mock_post_requests):
200-
with patch.dict(sys.modules, {"streamlit": "foo"}):
199+
@pytest.mark.skipolddriver
200+
@pytest.mark.parametrize(
201+
"sys_modules,application",
202+
[
203+
({"streamlit": None}, "streamlit"),
204+
(
205+
{"ipykernel": None, "jupyter_core": None, "jupyter_client": None},
206+
"jupyter_notebook",
207+
),
208+
({"snowbooks": None}, "snowflake_notebook"),
209+
],
210+
)
211+
async def test_imported_module(mock_post_requests, sys_modules, application):
212+
with patch.dict(sys.modules, sys_modules):
201213
async with fake_db_conn() as conn:
202-
assert conn.application == "streamlit"
214+
assert conn.application == application
203215

204216
assert (
205-
mock_post_requests["data"]["CLIENT_ENVIRONMENT"]["APPLICATION"] == "streamlit"
217+
mock_post_requests["data"]["CLIENT_ENVIRONMENT"]["APPLICATION"] == application
206218
)
207219

208220

0 commit comments

Comments
 (0)