Skip to content

Commit

Permalink
Fix the monitor errors test on Windows and hide unhelpful warnings there
Browse files Browse the repository at this point in the history
  • Loading branch information
pavel-kirienko committed Jan 23, 2024
1 parent 821ed9e commit fdd8dc2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ log_file_level = DEBUG
# Unraisable exceptions are filtered because PyTest yields false-positives coming from PyCyphal.
addopts = --doctest-modules -v -p no:unraisableexception
asyncio_mode = auto
filterwarnings =
ignore:.*SDL2.*:UserWarning

# ---------------------------------------- MYPY ----------------------------------------
[mypy]
Expand Down
7 changes: 5 additions & 2 deletions tests/cmd/monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,10 +290,13 @@ async def _run_zombie() -> None:
pres = pycyphal.presentation.Presentation(tr)
try:
pub = pres.make_publisher(Empty_1, 99)
pub.send_timeout = 5.0
sub = pres.make_subscriber(Empty_1, 99) # Ensure there's an RX socket on Windows.
while True:
await pub.publish(Empty_1())
assert await pub.publish(Empty_1())
await asyncio.sleep(0.5)
except (asyncio.TimeoutError, asyncio.CancelledError): # pragma: no cover
_ = await sub.receive_for(0.0) # Avoid queue overrun.
except (asyncio.TimeoutError, asyncio.CancelledError, GeneratorExit): # pragma: no cover
pass
finally:
pres.close()
Expand Down
4 changes: 4 additions & 0 deletions yakut/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
# Author: Pavel Kirienko <[email protected]>

if __name__ == "__main__":
from warnings import filterwarnings

filterwarnings("ignore") # Warnings are meant for developers and should not be shown to users.

from yakut import main

main() # pylint: disable=no-value-for-parameter

0 comments on commit fdd8dc2

Please sign in to comment.