summaryrefslogtreecommitdiff
path: root/lib/spack/spack/test/llnl/util/lock.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/spack/spack/test/llnl/util/lock.py')
-rw-r--r--lib/spack/spack/test/llnl/util/lock.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/spack/spack/test/llnl/util/lock.py b/lib/spack/spack/test/llnl/util/lock.py
index 15129aa9b7..c22288f430 100644
--- a/lib/spack/spack/test/llnl/util/lock.py
+++ b/lib/spack/spack/test/llnl/util/lock.py
@@ -687,8 +687,8 @@ def test_upgrade_read_to_write_fails_with_readonly_file(private_lock_path):
with pytest.raises(lk.LockROFileError):
lock.acquire_write()
- # TODO: lk.file_tracker does not release private_lock_path
- lk.file_tracker.release_by_stat(os.stat(private_lock_path))
+ # TODO: lk.FILE_TRACKER does not release private_lock_path
+ lk.FILE_TRACKER.release_by_stat(os.stat(private_lock_path))
class ComplexAcquireAndRelease:
@@ -1345,8 +1345,7 @@ def test_poll_lock_exception(tmpdir, monkeypatch, err_num, err_msg):
with tmpdir.as_cwd():
lockfile = "lockfile"
lock = lk.Lock(lockfile)
-
- touch(lockfile)
+ lock.acquire_read()
monkeypatch.setattr(fcntl, "lockf", _lockf)
@@ -1356,6 +1355,9 @@ def test_poll_lock_exception(tmpdir, monkeypatch, err_num, err_msg):
with pytest.raises(IOError, match=err_msg):
lock._poll_lock(fcntl.LOCK_EX)
+ monkeypatch.undo()
+ lock.release_read()
+
def test_upgrade_read_okay(tmpdir):
"""Test the lock read-to-write upgrade operation."""