Skip to content

Commit

Permalink
Fix test for python 3.10
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom-Willemsen committed Aug 11, 2024
1 parent cd73676 commit 74ed3e3
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion tests/devices/test_block.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import asyncio
import sys
from unittest.mock import MagicMock, patch

import pytest
Expand All @@ -7,6 +9,12 @@
MOCK_PREFIX = "UNITTEST:MOCK:"


if sys.version_info <= (3, 10):
aio_timeout_error = asyncio.exceptions.TimeoutError
else:
aio_timeout_error = TimeoutError


@pytest.fixture
async def simple_block() -> BlockRwRbv[float]:
block = BlockRwRbv(float, MOCK_PREFIX, "float_block")
Expand Down Expand Up @@ -77,7 +85,7 @@ async def test_block_set_with_timeout():

set_mock_value(block.readback, 10)

with pytest.raises(TimeoutError):
with pytest.raises(aio_timeout_error):
await block.set(20)

func.assert_called_once_with(20, 10)
Expand Down

0 comments on commit 74ed3e3

Please sign in to comment.