Cancellable md5sum calculation on thread, Ref. gui#2239

This commit is contained in:
ziajka committed 2018-01-29 10:18:13 +01:00
1 parent 6868e20a70
commit dc377165f2
4 files changed
+47 -2

No files matched your search

+13
View File
@@ -17,6 +17,7 @@
import os
import sys
import threading
from unittest.mock import patch
@@ -57,6 +58,18 @@ def test_md5sum(tmpdir):
assert f.read() == '5d41402abc4b2a76b9719d911017c592'
def test_md5sum_stopped_event(tmpdir):
fake_img = str(tmpdir / 'hello_stopped')
with open(fake_img, 'w+') as f:
f.write('hello')
event = threading.Event()
event.set()
assert md5sum(fake_img, stopped_event=event) is None
assert not os.path.exists(str(tmpdir / 'hello_stopped.md5sum'))
def test_md5sum_existing_digest(tmpdir):
fake_img = str(tmpdir / 'hello')