Skip to content

Commit

Permalink
Catch expected pytest warning about invalid COT_URL
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jwdinius committed Oct 11, 2024
1 parent 778b5b1 commit f3c4d20
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tests/test_client_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,9 @@ async def test_protocol_factory_bad_url():
"""Test calling `pytak.protocol_factory()` with a bad URL."""
test_url1: str = "udp:localhost"
config: dict = {"COT_URL": test_url1}
with pytest.raises(Exception):
await pytak.protocol_factory(config)
with pytest.warns(SyntaxWarning, match="Invalid COT_URL"):
with pytest.raises(Exception):
await pytak.protocol_factory(config)


@pytest.mark.asyncio
Expand Down

0 comments on commit f3c4d20

Please sign in to comment.