From eddd2b31f2bf62b7b88f98b20733bd778ef31132 Mon Sep 17 00:00:00 2001 From: Pavel Kirienko Date: Tue, 9 Jan 2024 00:17:28 +0300 Subject: [PATCH] Improve the robustness of the timing-sensitive tests on Windows (#320) The Windows pipelines have been behaving badly lately; this is an attempt to improve them. --- pycyphal/_version.py | 2 +- tests/__init__.py | 1 + .../monotonic_clustering.py | 14 +++++++------- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/pycyphal/_version.py b/pycyphal/_version.py index 30244104a..c7bbe4965 100644 --- a/pycyphal/_version.py +++ b/pycyphal/_version.py @@ -1 +1 @@ -__version__ = "1.17.0" +__version__ = "1.17.1" diff --git a/tests/__init__.py b/tests/__init__.py index fdf89845e..3cf7fcf9c 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -64,4 +64,5 @@ def doctest_await(future: Awaitable[_T]) -> _T: This is a hack; when the proper solution is available it should be removed: https://github.com/Erotemic/xdoctest/issues/115 """ + asyncio.get_event_loop().slow_callback_duration = max(asyncio.get_event_loop().slow_callback_duration, 10.0) return asyncio.get_event_loop().run_until_complete(future) diff --git a/tests/presentation/subscription_synchronizer/monotonic_clustering.py b/tests/presentation/subscription_synchronizer/monotonic_clustering.py index 4d021de70..4c2ea20f5 100644 --- a/tests/presentation/subscription_synchronizer/monotonic_clustering.py +++ b/tests/presentation/subscription_synchronizer/monotonic_clustering.py @@ -58,37 +58,37 @@ def ts() -> SynchronizedTimestamp_1: await pub_a.publish(force.Scalar_1(ts(), reference)) await pub_b.publish(power.Scalar_1(ts(), reference)) await pub_c.publish(angle.Scalar_1(ts(), reference)) - await asyncio.sleep(0.1) + await asyncio.sleep(1.0) assert 1 == cb_count reference += 1 await pub_c.publish(angle.Scalar_1(ts(), reference)) # Reordered. await pub_b.publish(power.Scalar_1(ts(), reference)) await pub_a.publish(force.Scalar_1(ts(), reference)) - await asyncio.sleep(0.1) + await asyncio.sleep(1.0) assert 2 == cb_count reference += 1 await pub_b.publish(power.Scalar_1(ts(), 999999999)) # Incorrect, will be overridden next. await pub_b.publish(power.Scalar_1(ts(), reference)) # Override the incorrect value. - await asyncio.sleep(0.1) + await asyncio.sleep(1.0) await pub_a.publish(force.Scalar_1(ts(), reference)) await pub_c.publish(angle.Scalar_1(ts(), reference)) - await asyncio.sleep(0.1) + await asyncio.sleep(1.0) assert 3 == cb_count reference += 1 await pub_a.publish(force.Scalar_1(ts(), reference)) # b skip await pub_c.publish(angle.Scalar_1(ts(), reference)) - await asyncio.sleep(0.1) + await asyncio.sleep(1.0) assert 3 == cb_count reference += 1 # a skip await pub_b.publish(power.Scalar_1(ts(), reference)) await pub_c.publish(angle.Scalar_1(ts(), reference)) - await asyncio.sleep(0.1) + await asyncio.sleep(1.0) assert 3 == cb_count for i in range(10): @@ -96,7 +96,7 @@ def ts() -> SynchronizedTimestamp_1: await pub_a.publish(force.Scalar_1(ts(), reference)) await pub_b.publish(power.Scalar_1(ts(), reference)) await pub_c.publish(angle.Scalar_1(ts(), reference)) - await asyncio.sleep(0.1) + await asyncio.sleep(1.0) assert 4 + i == cb_count pres.close()