comparison tests/test_util.py @ 1081:c8d0f5983571

tests: cd to tempdir during setUp Since we were running hg clone from the hgsubversion repo, we would often pick up config settings from hgsubversion/.hg/hgrc, including loading extensions. This caused tests to fail for me when they asserted that obsolete is disabled because I have evolve enabled in my hgsubversion checkout. This was probably decreasing the overall stability of the test suite as well, since it meant that clones were running with pretty much arbitrary configs settings. Interestingly, the setUp was already keeping a record of the cwd before creating the tempdir, and tearDown was already cd-ing back to that directory.
author David Schleimer <dschleimer@fb.com>
date Wed, 14 Aug 2013 17:33:40 -0700
parents 661f4065bfbf
children ca36d5915dc7
comparison
equal deleted inserted replaced
1080:661f4065bfbf 1081:c8d0f5983571
364 i18n.t = gettext.translation('hg', i18n.localedir, fallback=True) 364 i18n.t = gettext.translation('hg', i18n.localedir, fallback=True)
365 365
366 self.oldwd = os.getcwd() 366 self.oldwd = os.getcwd()
367 self.tmpdir = tempfile.mkdtemp( 367 self.tmpdir = tempfile.mkdtemp(
368 'svnwrap_test', dir=os.environ.get('HGSUBVERSION_TEST_TEMP', None)) 368 'svnwrap_test', dir=os.environ.get('HGSUBVERSION_TEST_TEMP', None))
369 os.chdir(self.tmpdir)
369 self.hgrc = os.path.join(self.tmpdir, '.hgrc') 370 self.hgrc = os.path.join(self.tmpdir, '.hgrc')
370 os.environ['HGRCPATH'] = self.hgrc 371 os.environ['HGRCPATH'] = self.hgrc
371 scmutil._rcpath = None 372 scmutil._rcpath = None
372 rc = open(self.hgrc, 'w') 373 rc = open(self.hgrc, 'w')
373 rc.write('[ui]\nusername=test-user\n') 374 rc.write('[ui]\nusername=test-user\n')