# HG changeset patch # User Augie Fackler # Date 1521920506 14400 # Node ID ed2df771f5781904484a793ceef5e126d3d956d0 # Parent 22137e94411f0357288839ce396b8a40d2861024 test_util: modernize writing of hgrc diff --git a/tests/test_util.py b/tests/test_util.py --- 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