GitHub Actions / Test Results
failed
Oct 10, 2024 in 0s
1 fail, 1 skipped, 247 pass in 1m 32s
249 tests 247 ✅ 1m 32s ⏱️
1 suites 1 💤
1 files 1 ❌
Results for commit f9b76dd.
Annotations
Check warning on line 0 in sarracenia.interruptible_sleep_test
github-actions / Test Results
test_interruptible_sleep (sarracenia.interruptible_sleep_test) failed
tests/junit/test-results.xml [took 20s]
Raw output
assert 10 == 5
+ where 10 = (datetime.datetime(2024, 10, 10, 19, 45, 30, 319923) - datetime.datetime(2024, 10, 10, 19, 45, 20, 312016)).seconds
def test_interruptible_sleep():
st = SleepThing()
stime = 10
# Test that sleep sleeps for the right amount of time when not interrupted
before_time = datetime.datetime.now()
result = interruptible_sleep(stime, st)
after_time = datetime.datetime.now()
assert (result == False)
assert ( (after_time - before_time).seconds == stime)
# Test that the sleep behaves correctly when interrupted
# send a SIGINT to this process after 5 seconds:
cmdline = f"""bash -c '/usr/bin/sleep 5; kill -SIGTERM {os.getpid()};' &"""
subprocess.run(cmdline, shell=True)
before_time = datetime.datetime.now()
result = interruptible_sleep(stime, st)
after_time = datetime.datetime.now()
assert result
> assert ( (after_time - before_time).seconds == 5)
E assert 10 == 5
E + where 10 = (datetime.datetime(2024, 10, 10, 19, 45, 30, 319923) - datetime.datetime(2024, 10, 10, 19, 45, 20, 312016)).seconds
tests/sarracenia/interruptible_sleep_test.py:41: AssertionError
Loading