Awight has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/342969 )
Change subject: test failopen; py3 ...................................................................... test failopen; py3 Change-Id: Id33866f7887aa404f453cf5ced6307fd83e2c2fd --- M lock.py M tests/test_lock.py 2 files changed, 15 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/process-control refs/changes/69/342969/1 diff --git a/lock.py b/lock.py index 7efd9d7..67e2cdd 100644 --- a/lock.py +++ b/lock.py @@ -3,6 +3,7 @@ Self-corrects stale locks unless "failopen" is True. ''' +from __future__ import print_function import os import os.path import sys diff --git a/tests/test_lock.py b/tests/test_lock.py index c06e4dd..469d019 100644 --- a/tests/test_lock.py +++ b/tests/test_lock.py @@ -45,6 +45,20 @@ lock.end() +@nose.tools.raises(lock.LockError) +def test_stale_lock_failopen(): + tag = "stale-open" + lock.begin(job_tag=tag, failopen=True) + + # Make the lockfile stale by changing the process ID. + assert lock.lockfile + f = open(lock.lockfile, "w") + f.write("-1") + f.close() + + lock.begin(job_tag=tag) + + def test_invalid_lock(): tag = "stale" lock.begin(job_tag=tag) -- To view, visit https://gerrit.wikimedia.org/r/342969 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Id33866f7887aa404f453cf5ced6307fd83e2c2fd Gerrit-PatchSet: 1 Gerrit-Project: wikimedia/fundraising/process-control Gerrit-Branch: master Gerrit-Owner: Awight <awi...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits