This revision was automatically updated to reflect the committed changes.
Closed by commit rHGa007db19dc4d: tests: add missing b prefixes in 
test-atomictempfile.py (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2570?vs=6403&id=6422

REVISION DETAIL
  https://phab.mercurial-scm.org/D2570

AFFECTED FILES
  tests/test-atomictempfile.py

CHANGE DETAILS

diff --git a/tests/test-atomictempfile.py b/tests/test-atomictempfile.py
--- a/tests/test-atomictempfile.py
+++ b/tests/test-atomictempfile.py
@@ -17,8 +17,8 @@
 
 class testatomictempfile(unittest.TestCase):
     def setUp(self):
-        self._testdir = tempfile.mkdtemp('atomictempfiletest')
-        self._filename = os.path.join(self._testdir, 'testfilename')
+        self._testdir = tempfile.mkdtemp(b'atomictempfiletest')
+        self._filename = os.path.join(self._testdir, b'testfilename')
 
     def tearDown(self):
         shutil.rmtree(self._testdir, True)
@@ -28,14 +28,14 @@
         self.assertFalse(os.path.isfile(self._filename))
         tempfilename = file._tempname
         self.assertTrue(tempfilename in glob.glob(
-            os.path.join(self._testdir, '.testfilename-*')))
+            os.path.join(self._testdir, b'.testfilename-*')))
 
         file.write(b'argh\n')
         file.close()
 
         self.assertTrue(os.path.isfile(self._filename))
         self.assertTrue(tempfilename not in glob.glob(
-            os.path.join(self._testdir, '.testfilename-*')))
+            os.path.join(self._testdir, b'.testfilename-*')))
 
     # discard() removes the temp file without making the write permanent
     def testdiscard(self):
@@ -46,7 +46,7 @@
         file.discard()
 
         self.assertFalse(os.path.isfile(self._filename))
-        self.assertTrue(basename not in os.listdir('.'))
+        self.assertTrue(basename not in os.listdir(b'.'))
 
     # if a programmer screws up and passes bad args to atomictempfile, they
     # get a plain ordinary TypeError, not infinite recursion
@@ -58,7 +58,7 @@
     def testcheckambig(self):
         def atomicwrite(checkambig):
             f = atomictempfile(self._filename, checkambig=checkambig)
-            f.write('FOO')
+            f.write(b'FOO')
             f.close()
 
         # try some times, because reproduction of ambiguity depends on
@@ -97,27 +97,27 @@
     def testread(self):
         with open(self._filename, 'wb') as f:
             f.write(b'foobar\n')
-        file = atomictempfile(self._filename, mode='rb')
+        file = atomictempfile(self._filename, mode=b'rb')
         self.assertTrue(file.read(), b'foobar\n')
         file.discard()
 
     def testcontextmanagersuccess(self):
         """When the context closes, the file is closed"""
-        with atomictempfile('foo') as f:
-            self.assertFalse(os.path.isfile('foo'))
+        with atomictempfile(b'foo') as f:
+            self.assertFalse(os.path.isfile(b'foo'))
             f.write(b'argh\n')
-        self.assertTrue(os.path.isfile('foo'))
+        self.assertTrue(os.path.isfile(b'foo'))
 
     def testcontextmanagerfailure(self):
         """On exception, the file is discarded"""
         try:
-            with atomictempfile('foo') as f:
-                self.assertFalse(os.path.isfile('foo'))
+            with atomictempfile(b'foo') as f:
+                self.assertFalse(os.path.isfile(b'foo'))
                 f.write(b'argh\n')
                 raise ValueError
         except ValueError:
             pass
-        self.assertFalse(os.path.isfile('foo'))
+        self.assertFalse(os.path.isfile(b'foo'))
 
 if __name__ == '__main__':
     import silenttestrunner



To: durin42, #hg-reviewers
Cc: mercurial-devel
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to