Skip to content

Commit

Permalink
Always rounding up to avoid randomly failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
IlianIliev committed Nov 24, 2024
1 parent 8bfb806 commit 827f1e1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tests/test_asyncio/test_hash.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,9 @@ async def test_hpexpire_multiple_fields(r):
async def test_hexpireat_basic(r):
await r.delete("test:hash")
await r.hset("test:hash", mapping={"field1": "value1", "field2": "value2"})
exp_time = int((datetime.now() + timedelta(seconds=1)).timestamp())
exp_time = math.ceil((datetime.now() + timedelta(seconds=1)).timestamp())
assert await r.hexpireat("test:hash", exp_time, "field1") == [1]
await asyncio.sleep(1.1)
await asyncio.sleep(2.1)
assert await r.hexists("test:hash", "field1") is False
assert await r.hexists("test:hash", "field2") is True

Expand All @@ -140,9 +140,9 @@ async def test_hexpireat_basic(r):
async def test_hexpireat_with_datetime(r):
await r.delete("test:hash")
await r.hset("test:hash", mapping={"field1": "value1", "field2": "value2"})
exp_time = datetime.now() + timedelta(seconds=1)
exp_time = (datetime.now() + timedelta(seconds=2)).replace(microsecond=0)
assert await r.hexpireat("test:hash", exp_time, "field1") == [1]
await asyncio.sleep(1.1)
await asyncio.sleep(2.1)
assert await r.hexists("test:hash", "field1") is False
assert await r.hexists("test:hash", "field2") is True

Expand Down

0 comments on commit 827f1e1

Please sign in to comment.