tests/lockdelay.py
changeset 30068 a76d5ba7ac43
parent 28289 d493d64757eb
child 43076 2372284d9457
--- a/tests/lockdelay.py	Wed Aug 24 04:19:11 2016 +0200
+++ b/tests/lockdelay.py	Tue Aug 23 23:47:59 2016 +0200
@@ -7,20 +7,16 @@
 import os
 import time
 
-from mercurial import (
-    lock as lockmod,
-)
+def reposetup(ui, repo):
 
-class delaylock(lockmod.lock):
-    def lock(self):
-        delay = float(os.environ.get('HGPRELOCKDELAY', '0.0'))
-        if delay:
-            time.sleep(delay)
-        res = super(delaylock, self).lock()
-        delay = float(os.environ.get('HGPOSTLOCKDELAY', '0.0'))
-        if delay:
-            time.sleep(delay)
-        return res
-
-def extsetup(ui):
-    lockmod.lock = delaylock
+    class delayedlockrepo(repo.__class__):
+        def lock(self):
+            delay = float(os.environ.get('HGPRELOCKDELAY', '0.0'))
+            if delay:
+                time.sleep(delay)
+            res = super(delayedlockrepo, self).lock()
+            delay = float(os.environ.get('HGPOSTLOCKDELAY', '0.0'))
+            if delay:
+                time.sleep(delay)
+            return res
+    repo.__class__ = delayedlockrepo