Skip to content

Commit 169c2c9

Browse files
committed
Merge remote-tracking branch 'origin/master' into edge
2 parents 920a4a4 + b867424 commit 169c2c9

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

tests/test_mig_shared_localfile.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,16 @@
2727

2828
"""Unit tests for the migrid module pointed to in the filename"""
2929

30-
import binascii
3130
from contextlib import contextmanager
3231
import errno
3332
import fcntl
3433
import os
3534
import sys
36-
import zipfile
3735

38-
sys.path.append(os.path.realpath(os.path.join(os.path.dirname(__file__), ".")))
36+
sys.path.append(os.path.realpath(
37+
os.path.join(os.path.dirname(__file__), "..")))
3938

40-
from support import MigTestCase, fixturepath, temppath, testmain
39+
from tests.support import MigTestCase, fixturepath, temppath, testmain
4140
from mig.shared.serverfile import LOCK_EX
4241
from mig.shared.localfile import LocalFile
4342

@@ -67,13 +66,12 @@ def assertPathLockedExclusive(self, file_path):
6766
with open(file_path) as conflicting_f:
6867
reraise = None
6968
try:
70-
fcntl.flock(
71-
conflicting_f, fcntl.LOCK_NB | LOCK_EX)
69+
fcntl.flock(conflicting_f, fcntl.LOCK_NB | LOCK_EX)
7270

7371
# we were errantly able to acquire a lock, mark errored
7472
reraise = AssertionError("RERAISE_MUST_UNLOCK")
75-
except Exception as maybeerr:
76-
if getattr(maybeerr, 'errno', None) == errno.EAGAIN:
73+
except Exception as maybe_err:
74+
if getattr(maybe_err, 'errno', None) == errno.EAGAIN:
7775
# this is the expected exception - the logic tried to lock
7876
# a file that was (as we intended) already locked, meaning
7977
# this assertion has succeeded so we do not need to raise
@@ -87,7 +85,7 @@ def assertPathLockedExclusive(self, file_path):
8785
if str(reraise) == 'RERAISE_MUST_UNLOCK':
8886
fcntl.flock(conflicting_f, fcntl.LOCK_NB | fcntl.LOCK_UN)
8987

90-
# raise a user-friendly error to aovid nested raise
88+
# raise a user-friendly error to avoid nested raise
9189
raise AssertionError(
9290
"expected locked file: %s" % self.pretty_display_path(file_path))
9391

0 commit comments

Comments
 (0)