diff --git a/PRESUBMIT.py b/PRESUBMIT.py index 790cd5de0..00d06be04 100644 --- a/PRESUBMIT.py +++ b/PRESUBMIT.py @@ -73,10 +73,8 @@ def CommonChecks(input_api, output_api, tests_to_black_list, run_on_python3): r'.*download_from_google_storage_unittest\.py$', r'.*gclient_scm_test\.py$', r'.*gclient_smoketest\.py$', - r'.*git_cache_test\.py$', r'.*git_cl_test\.py$', r'.*git_common_test\.py$', - r'.*git_footers_test\.py$', r'.*git_hyper_blame_test\.py$', r'.*git_number_test\.py$', r'.*git_rebase_update_test\.py$', diff --git a/tests/git_cache_test.py b/tests/git_cache_test.py index db4c2fbc1..394555f26 100755 --- a/tests/git_cache_test.py +++ b/tests/git_cache_test.py @@ -28,7 +28,8 @@ class GitCacheTest(unittest.TestCase): def git(self, cmd, cwd=None): cwd = cwd or self.origin_dir - subprocess.check_call(['git'] + cmd, cwd=cwd) + git = 'git.bat' if sys.platform == 'win32' else 'git' + subprocess.check_call([git] + cmd, cwd=cwd) def testParseFetchSpec(self): testData = [ diff --git a/tests/git_footers_test.py b/tests/git_footers_test.py index e37199d71..21bc1bb03 100755 --- a/tests/git_footers_test.py +++ b/tests/git_footers_test.py @@ -252,9 +252,15 @@ My commit message is my best friend. It is my life. I must master it. 'sys.stdin', StringIO('line\r\nany spaces\r\n\r\n\r\nFoo: 1\nBar: 2\nFoo: 3')) def testToJson(self): - with tempfile.NamedTemporaryFile() as tmp: - self.assertEqual(git_footers.main(['--json', tmp.name]), 0) - js = json.load(open(tmp.name)) + with tempfile.NamedTemporaryFile(delete=False) as tmp: + try: + # NamedTemporaryFiles must be closed on Windows before being opened + # again. + tmp.close() + self.assertEqual(git_footers.main(['--json', tmp.name]), 0) + js = json.load(open(tmp.name)) + finally: + os.remove(tmp.name) self.assertEqual(js, {'Foo': ['3', '1'], 'Bar': ['2']})