diff --git a/test/back2back_test.py b/test/back2back_test.py index 738c9d16b..ce7c39e2a 100644 --- a/test/back2back_test.py +++ b/test/back2back_test.py @@ -33,7 +33,7 @@ class Back2BackTestCase(unittest.TestCase): """ BITRATE = 500000 - TIMEOUT = 0.1 + TIMEOUT = 1.0 if IS_PYPY else 0.1 INTERFACE_1 = "virtual" CHANNEL_1 = "virtual_channel_0" diff --git a/test/simplecyclic_test.py b/test/simplecyclic_test.py index 91bbf3bbe..22a11e643 100644 --- a/test/simplecyclic_test.py +++ b/test/simplecyclic_test.py @@ -5,18 +5,18 @@ """ import gc +import platform import sys import time import traceback import unittest from threading import Thread from time import sleep -from typing import List from unittest.mock import MagicMock import can -from .config import * +from .config import IS_CI, IS_PYPY from .message_helper import ComparingMessagesTestCase @@ -133,7 +133,7 @@ def test_stopping_perodic_tasks(self): data=[0, 1, 2, 3, 4, 5, 6, 7], ) msg.arbitration_id = task_i - task = bus.send_periodic(msg, 0.1, 1) + task = bus.send_periodic(msg, period=0.1) tasks.append(task) assert len(bus._periodic_tasks) == 10 @@ -261,7 +261,7 @@ def test_thread_based_cyclic_send_task(self): task.stop() def test_modifier_callback(self) -> None: - msg_list: List[can.Message] = [] + msg_list: list[can.Message] = [] def increment_first_byte(msg: can.Message) -> None: msg.data[0] = (msg.data[0] + 1) % 256 @@ -288,8 +288,8 @@ def increment_first_byte(msg: can.Message) -> None: self.assertEqual(b"\x07\x00\x00\x00\x00\x00\x00\x00", bytes(msg_list[6].data)) @staticmethod - def join_threads(threads: List[Thread], timeout: float) -> None: - stuck_threads: List[Thread] = [] + def join_threads(threads: list[Thread], timeout: float) -> None: + stuck_threads: list[Thread] = [] t0 = time.perf_counter() for thread in threads: time_left = timeout - (time.perf_counter() - t0)