Skip to content

Commit

Permalink
tests: Make test_simple_write_and_retrieval more timing-robust
Browse files Browse the repository at this point in the history
  • Loading branch information
mhthies committed Dec 22, 2023
1 parent fc2bdd7 commit 5197b63
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions test/test_data_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,11 +231,11 @@ async def test_simple_write_and_retrieval(self) -> None:
var1 = await self._create_log_variable_with_data(int, [])
start_ts = datetime.datetime.now().astimezone()
await var1.write(1, [self]) # type: ignore
await asyncio.sleep(0.2)
await asyncio.sleep(0.3)
await var1.write(2, [self]) # type: ignore
await asyncio.sleep(0.1)
await var1.write(3, [self]) # type: ignore
await asyncio.sleep(0.7)
await asyncio.sleep(0.6)
await var1.write(4, [self]) # type: ignore
await asyncio.sleep(0.05)
await var1.write(5, [self]) # type: ignore
Expand All @@ -253,9 +253,9 @@ async def test_simple_write_and_retrieval(self) -> None:
self.assertEqual(4, len(data))
self.assertListEqual([2, 3, 4, 5], [v for _ts, v in data])
self.assertAlmostEqual(data[0][0], start_ts + datetime.timedelta(seconds=0.2),
delta=datetime.timedelta(milliseconds=100))
delta=datetime.timedelta(milliseconds=200))
self.assertAlmostEqual(data[-1][0], start_ts + datetime.timedelta(seconds=1.05),
delta=datetime.timedelta(milliseconds=100))
delta=datetime.timedelta(milliseconds=200))

# Check reading
self.assertEqual(5, await var1.read()) # type: ignore
Expand Down

0 comments on commit 5197b63

Please sign in to comment.