changeset 39948:5ee3146c1b20

py3: byteify test-lock.py There's still a stacktrace about not being able to serialize _io.TextIOWrapper.
author Matt Harbison <matt_harbison@yahoo.com>
date Mon, 01 Oct 2018 21:54:00 -0400
parents a063b84ce064
children e1f97179a3f5
files tests/test-lock.py
diffstat 1 files changed, 10 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-lock.py	Mon Oct 01 21:48:45 2018 -0400
+++ b/tests/test-lock.py	Mon Oct 01 21:54:00 2018 -0400
@@ -2,19 +2,19 @@
 
 import copy
 import errno
-import os
 import silenttestrunner
 import tempfile
 import types
 import unittest
 
 from mercurial import (
+    encoding,
     error,
     lock,
     vfs as vfsmod,
 )
 
-testlockname = 'testlock'
+testlockname = b'testlock'
 
 # work around http://bugs.python.org/issue1515
 if types.MethodType not in copy._deepcopy_dispatch:
@@ -106,7 +106,7 @@
 
 class testlock(unittest.TestCase):
     def testlock(self):
-        state = teststate(self, tempfile.mkdtemp(dir=os.getcwd()))
+        state = teststate(self, tempfile.mkdtemp(dir=encoding.getcwd()))
         lock = state.makelock()
         state.assertacquirecalled(True)
         lock.release()
@@ -115,7 +115,7 @@
         state.assertlockexists(False)
 
     def testrecursivelock(self):
-        state = teststate(self, tempfile.mkdtemp(dir=os.getcwd()))
+        state = teststate(self, tempfile.mkdtemp(dir=encoding.getcwd()))
         lock = state.makelock()
         state.assertacquirecalled(True)
 
@@ -135,7 +135,7 @@
         state.assertlockexists(False)
 
     def testlockfork(self):
-        state = teststate(self, tempfile.mkdtemp(dir=os.getcwd()))
+        state = teststate(self, tempfile.mkdtemp(dir=encoding.getcwd()))
         lock = state.makelock()
         state.assertacquirecalled(True)
 
@@ -154,7 +154,7 @@
         state.assertlockexists(False)
 
     def testinheritlock(self):
-        d = tempfile.mkdtemp(dir=os.getcwd())
+        d = tempfile.mkdtemp(dir=encoding.getcwd())
         parentstate = teststate(self, d)
         parentlock = parentstate.makelock()
         parentstate.assertacquirecalled(True)
@@ -184,7 +184,7 @@
         parentstate.assertlockexists(False)
 
     def testmultilock(self):
-        d = tempfile.mkdtemp(dir=os.getcwd())
+        d = tempfile.mkdtemp(dir=encoding.getcwd())
         state0 = teststate(self, d)
         lock0 = state0.makelock()
         state0.assertacquirecalled(True)
@@ -225,7 +225,7 @@
         lock0.release()
 
     def testinheritlockfork(self):
-        d = tempfile.mkdtemp(dir=os.getcwd())
+        d = tempfile.mkdtemp(dir=encoding.getcwd())
         parentstate = teststate(self, d)
         parentlock = parentstate.makelock()
         parentstate.assertacquirecalled(True)
@@ -253,7 +253,7 @@
         parentlock.release()
 
     def testinheritcheck(self):
-        d = tempfile.mkdtemp(dir=os.getcwd())
+        d = tempfile.mkdtemp(dir=encoding.getcwd())
         state = teststate(self, d)
         def check():
             raise error.LockInheritanceContractViolation('check failed')
@@ -273,7 +273,7 @@
         retrying 5 times.
         """
 
-        d = tempfile.mkdtemp(dir=os.getcwd())
+        d = tempfile.mkdtemp(dir=encoding.getcwd())
         state = teststate(self, d)
 
         def emulatefrequentlock(*args):