Skip to content

Commit ebf070a

Browse files
committed
Always rounding up to avoid randomly failing tests
1 parent 70cc510 commit ebf070a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

tests/test_asyncio/test_hash.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,9 @@ async def test_hpexpire_multiple_fields(r):
129129
async def test_hexpireat_basic(r):
130130
await r.delete("test:hash")
131131
await r.hset("test:hash", mapping={"field1": "value1", "field2": "value2"})
132-
exp_time = int((datetime.now() + timedelta(seconds=1)).timestamp())
132+
exp_time = math.ceil((datetime.now() + timedelta(seconds=1)).timestamp())
133133
assert await r.hexpireat("test:hash", exp_time, "field1") == [1]
134-
await asyncio.sleep(1.1)
134+
await asyncio.sleep(2.1)
135135
assert await r.hexists("test:hash", "field1") is False
136136
assert await r.hexists("test:hash", "field2") is True
137137

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

0 commit comments

Comments
 (0)