changeset 1552:ed2df771f578

test_util: modernize writing of hgrc
author Augie Fackler <raf@durin42.com>
date Sat, 24 Mar 2018 15:41:46 -0400
parents 22137e94411f
children 601eaa89ca98
files tests/test_util.py
diffstat 1 files changed, 3 insertions(+), 4 deletions(-) [+]
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