Skip to content

Commit 748bb64

Browse files
committed
Catch expected pytest warning about invalid COT_URL
Running the suite of pytest tests yields a single warning: ``` tests/test_client_functions.py::test_protocol_factory_bad_url Warning: Invalid COT_URL=udp:localhost ``` Based on the context of the test, this warning shouldn't be flagged as a warning at all. The warning is expected. This commit explicitly catches the expected warning from pytest and marks the test as an unconditional pass.
1 parent d57bd8a commit 748bb64

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tests/test_client_functions.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,9 @@ async def test_protocol_factory_bad_url():
145145
"""Test calling `pytak.protocol_factory()` with a bad URL."""
146146
test_url1: str = "udp:localhost"
147147
config: dict = {"COT_URL": test_url1}
148-
with pytest.raises(Exception):
149-
await pytak.protocol_factory(config)
148+
with pytest.warns(SyntaxWarning, match="Invalid COT_URL"):
149+
with pytest.raises(Exception):
150+
await pytak.protocol_factory(config)
150151

151152

152153
@pytest.mark.asyncio

0 commit comments

Comments
 (0)