diff --git a/.github/workflows/test-and-release.yml b/.github/workflows/test-and-release.yml index e763b78..0d941bf 100644 --- a/.github/workflows/test-and-release.yml +++ b/.github/workflows/test-and-release.yml @@ -58,7 +58,7 @@ jobs: FORCE_COLOR: 1 - name: Prepare the snapshot archive - if: always() + if: (success() || failure()) && (runner.os == 'Linux') # language=bash run: | sudo apt-get install lrzip @@ -66,7 +66,7 @@ jobs: - name: Upload diagnostic snapshot uses: actions/upload-artifact@v3 - if: always() + if: (success() || failure()) && (runner.os == 'Linux') with: name: ${{github.job}} path: snapshot.lrz diff --git a/setup.cfg b/setup.cfg index 6335741..97c23ab 100644 --- a/setup.cfg +++ b/setup.cfg @@ -93,10 +93,11 @@ testpaths = yakut tests python_files = *.py python_classes = _UnitTest python_functions = _unittest_ -log_level = DEBUG +log_level = INFO log_cli_level = WARNING log_cli = true log_file = pytest.log +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 diff --git a/tests/cmd/monitor.py b/tests/cmd/monitor.py index db5f440..2c111c8 100755 --- a/tests/cmd/monitor.py +++ b/tests/cmd/monitor.py @@ -74,7 +74,7 @@ async def _unittest_monitor_nodes(compiled_dsdl: Any) -> None: asyncio.create_task(_delay(_run_nodes(), 1.0, duration=5.0)), asyncio.create_task(_delay(_run_anonymous(), 1.0, duration=5.0)), ] - cells = [x.split() for x in (await _monitor_and_get_last_screen(15.0, 42)).splitlines()] + cells = [x.split() for x in (await _monitor_and_get_last_screen(20.0, 42)).splitlines()] await asyncio.gather(*tasks) await asyncio.sleep(3.0) @@ -171,10 +171,10 @@ async def _monitor_and_get_last_screen(duration: float, node_id: Optional[int]) assert "Traceback" not in stderr screens = stdout.split("\n" * 3) - assert len(screens) > 1 + assert len(screens) >= 1 assert len(screens) < (duration * 0.5 + 10) last_screen = screens[-1] - _logger.info("=== LAST SCREEN ===\n" + last_screen) + _logger.info("=== LAST SCREEN ===\n%s", last_screen) return last_screen except Exception: # pragma: no cover proc.kill() @@ -257,6 +257,7 @@ def instantiate(info: NodeInfo, node_id: int, mode: int, health: int, vssc: int) ), ] pub = nodes[0].make_publisher(String_1, "spam") + pub.send_timeout = 5.0 nodes[1].make_subscriber(String_1, "spam").receive_in_background(subscription_sink) nodes[2].make_subscriber(String_1, "spam").receive_in_background(subscription_sink) nodes[3].make_subscriber(String_1, "null").receive_in_background(subscription_sink) # No publishers. diff --git a/yakut/__init__.py b/yakut/__init__.py index 121596c..658489c 100644 --- a/yakut/__init__.py +++ b/yakut/__init__.py @@ -2,18 +2,22 @@ # This software is distributed under the terms of the MIT License. # Author: Pavel Kirienko +# Disabling unused ignores because we need to support differnt versions of importlib.resources. +# mypy: warn_unused_ignores=False +# pylint: disable=wrong-import-position + import typing def _read_package_file(name: str) -> str: try: - from importlib.resources import files + from importlib.resources import files # type: ignore - return (files(__name__) / name).read_text(encoding="utf8") + return (files(__name__) / name).read_text(encoding="utf8") # type: ignore except ImportError: # This is for the old Pythons; read_text is deprecated in 3.11 - from importlib.resources import read_text + from importlib.resources import read_text # type: ignore - return read_text(__name__, name, encoding="utf8") + return read_text(__name__, name, encoding="utf8") # type: ignore __version__: str = _read_package_file("VERSION").strip()