diff tests/test_util.py @ 1552:ed2df771f578

test_util: modernize writing of hgrc
author Augie Fackler <raf@durin42.com>
date Sat, 24 Mar 2018 15:41:46 -0400
parents 8410a978c650
children 258fb67fb956
line wrap: on
line diff
--- a/tests/test_util.py
+++ b/tests/test_util.py
@@ -497,10 +497,9 @@ class TestBase(unittest.TestCase):
         self.hgrc = os.path.join(self.tmpdir, '.hgrc')
         os.environ['HGRCPATH'] = self.hgrc
         scmutil._rcpath = None
-        rc = open(self.hgrc, 'w')
-        rc.write('[ui]\nusername=test-user\n')
-        for l in '[extensions]', 'hgsubversion=':
-            print >> rc, l
+        with open(self.hgrc, 'w') as rc:
+            rc.write('[ui]\nusername=test-user\n')
+            rc.write('[extensions]\nhgsubversion=\n')
 
         self.repocount = 0
         self.wc_path = '%s/testrepo_wc' % self.tmpdir