aboutsummaryrefslogtreecommitdiffstats
path: root/library/python/filelock/ut/lib
diff options
context:
space:
mode:
authorAleksandr <ivansduck@gmail.com>2022-02-10 16:47:52 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:47:52 +0300
commitea6c5b7f172becca389cacaff7d5f45f6adccbe6 (patch)
treed16cef493ac1e092b4a03ab9437ec06ffe3d188f /library/python/filelock/ut/lib
parent37de222addabbef336dcaaea5f7c7645a629fc6d (diff)
downloadydb-ea6c5b7f172becca389cacaff7d5f45f6adccbe6.tar.gz
Restoring authorship annotation for Aleksandr <ivansduck@gmail.com>. Commit 1 of 2.
Diffstat (limited to 'library/python/filelock/ut/lib')
-rw-r--r--library/python/filelock/ut/lib/test_filelock.py56
1 files changed, 28 insertions, 28 deletions
diff --git a/library/python/filelock/ut/lib/test_filelock.py b/library/python/filelock/ut/lib/test_filelock.py
index 1b11d891231..a5624f827c3 100644
--- a/library/python/filelock/ut/lib/test_filelock.py
+++ b/library/python/filelock/ut/lib/test_filelock.py
@@ -3,7 +3,7 @@ import time
import logging
import multiprocessing
import tempfile
-import threading
+import threading
import library.python.filelock
@@ -48,36 +48,36 @@ def test_filelock():
time1 = time2
-def test_filelock_init_acquired():
+def test_filelock_init_acquired():
temp_dir = tempfile.mkdtemp()
lock_path = os.path.join(temp_dir, "file.lock")
with library.python.filelock.FileLock(lock_path):
sublock = library.python.filelock.FileLock(lock_path)
del sublock
-
-
-def test_concurrent_lock():
- filename = 'con.lock'
-
- def lock():
- l = library.python.filelock.FileLock(filename)
- time.sleep(1)
- l.acquire()
- l.release()
- try:
- os.unlink(filename)
- except OSError:
- pass
-
- threads = []
- for i in range(100):
- t = threading.Thread(target=lock)
- t.daemon = True
- threads.append(t)
-
- for t in threads:
- t.start()
-
- for t in threads:
- t.join()
+
+
+def test_concurrent_lock():
+ filename = 'con.lock'
+
+ def lock():
+ l = library.python.filelock.FileLock(filename)
+ time.sleep(1)
+ l.acquire()
+ l.release()
+ try:
+ os.unlink(filename)
+ except OSError:
+ pass
+
+ threads = []
+ for i in range(100):
+ t = threading.Thread(target=lock)
+ t.daemon = True
+ threads.append(t)
+
+ for t in threads:
+ t.start()
+
+ for t in threads:
+ t.join()