Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(465)

Side by Side Diff: Tools/Scripts/webkitpy/common/checkout/scm/scm_unittest.py

Issue 558103003: [SCM tests] Don't forget to change back to original cwd. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (C) 2009 Google Inc. All rights reserved. 1 # Copyright (C) 2009 Google Inc. All rights reserved.
2 # Copyright (C) 2009 Apple Inc. All rights reserved. 2 # Copyright (C) 2009 Apple Inc. All rights reserved.
3 # Copyright (C) 2011 Daniel Bates (dbates@intudata.com). All rights reserved. 3 # Copyright (C) 2011 Daniel Bates (dbates@intudata.com). All rights reserved.
4 # 4 #
5 # Redistribution and use in source and binary forms, with or without 5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions are 6 # modification, are permitted provided that the following conditions are
7 # met: 7 # met:
8 # 8 #
9 # * Redistributions of source code must retain the above copyright 9 # * Redistributions of source code must retain the above copyright
10 # notice, this list of conditions and the following disclaimer. 10 # notice, this list of conditions and the following disclaimer.
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 self._run(['svn', 'checkout', '--quiet', svn_repo_url, svn_checkout_path ]) 148 self._run(['svn', 'checkout', '--quiet', svn_repo_url, svn_checkout_path ])
149 149
150 # Create and checkout a trunk dir to match the standard svn configuratio n to match git-svn's expectations 150 # Create and checkout a trunk dir to match the standard svn configuratio n to match git-svn's expectations
151 self._chdir(svn_checkout_path) 151 self._chdir(svn_checkout_path)
152 self._mkdir('trunk') 152 self._mkdir('trunk')
153 self._svn_add('trunk') 153 self._svn_add('trunk')
154 # We can add tags and branches as well if we ever need to test those. 154 # We can add tags and branches as well if we ever need to test those.
155 self._svn_commit('add trunk') 155 self._svn_commit('add trunk')
156 156
157 self._rmtree(svn_checkout_path) 157 self._rmtree(svn_checkout_path)
158 self._chdir(self.original_cwd)
158 159
159 self._set_up_svn_test_commits(svn_repo_url + "/trunk") 160 self._set_up_svn_test_commits(svn_repo_url + "/trunk")
160 return svn_repo_path 161 return svn_repo_path
161 162
162 def _set_up_svn_test_commits(self, svn_repo_url): 163 def _set_up_svn_test_commits(self, svn_repo_url):
163 svn_checkout_path = self._mkdtemp(suffix="svn_test_checkout") 164 svn_checkout_path = self._mkdtemp(suffix="svn_test_checkout")
164 self._run(['svn', 'checkout', '--quiet', svn_repo_url, svn_checkout_path ]) 165 self._run(['svn', 'checkout', '--quiet', svn_repo_url, svn_checkout_path ])
165 166
166 # Add some test commits 167 # Add some test commits
167 self._chdir(svn_checkout_path) 168 self._chdir(svn_checkout_path)
(...skipping 22 matching lines...) Expand all
190 # This 4th commit is used to make sure that our patch file handling 191 # This 4th commit is used to make sure that our patch file handling
191 # code correctly treats patches as binary and does not attempt to 192 # code correctly treats patches as binary and does not attempt to
192 # decode them assuming they're utf-8. 193 # decode them assuming they're utf-8.
193 self._write_binary_file("test_file", u"latin1 test: \u00A0\n".encode("la tin-1")) 194 self._write_binary_file("test_file", u"latin1 test: \u00A0\n".encode("la tin-1"))
194 self._write_binary_file("test_file2", u"utf-8 test: \u00A0\n".encode("ut f-8")) 195 self._write_binary_file("test_file2", u"utf-8 test: \u00A0\n".encode("ut f-8"))
195 self._svn_commit("fourth commit") 196 self._svn_commit("fourth commit")
196 197
197 # svn does not seem to update after commit as I would expect. 198 # svn does not seem to update after commit as I would expect.
198 self._run(['svn', 'update']) 199 self._run(['svn', 'update'])
199 self._rmtree(svn_checkout_path) 200 self._rmtree(svn_checkout_path)
201 self._chdir(self.original_cwd)
200 202
201 def _tear_down_svn_checkout(self): 203 def _tear_down_svn_checkout(self):
202 self._rmtree(self.temp_directory) 204 self._rmtree(self.temp_directory)
203 205
204 def _shared_test_add_recursively(self): 206 def _shared_test_add_recursively(self):
205 self._mkdir("added_dir") 207 self._mkdir("added_dir")
206 self._write_text_file("added_dir/added_file", "new stuff") 208 self._write_text_file("added_dir/added_file", "new stuff")
207 self.scm.add("added_dir/added_file") 209 self.scm.add("added_dir/added_file")
208 self.assertIn("added_dir/added_file", self.scm._added_files()) 210 self.assertIn("added_dir/added_file", self.scm._added_files())
209 211
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 scm = self.make_scm() 696 scm = self.make_scm()
695 scm.find_checkout_root = lambda path: '' 697 scm.find_checkout_root = lambda path: ''
696 scm._run_git = lambda args: 'Date: 2013-02-08 08:05:49 +0000' 698 scm._run_git = lambda args: 'Date: 2013-02-08 08:05:49 +0000'
697 self.assertEqual(scm.timestamp_of_revision('some-path', '12345'), '2013- 02-08T08:05:49Z') 699 self.assertEqual(scm.timestamp_of_revision('some-path', '12345'), '2013- 02-08T08:05:49Z')
698 700
699 scm._run_git = lambda args: 'Date: 2013-02-08 01:02:03 +0130' 701 scm._run_git = lambda args: 'Date: 2013-02-08 01:02:03 +0130'
700 self.assertEqual(scm.timestamp_of_revision('some-path', '12345'), '2013- 02-07T23:32:03Z') 702 self.assertEqual(scm.timestamp_of_revision('some-path', '12345'), '2013- 02-07T23:32:03Z')
701 703
702 scm._run_git = lambda args: 'Date: 2013-02-08 01:55:21 -0800' 704 scm._run_git = lambda args: 'Date: 2013-02-08 01:55:21 -0800'
703 self.assertEqual(scm.timestamp_of_revision('some-path', '12345'), '2013- 02-08T09:55:21Z') 705 self.assertEqual(scm.timestamp_of_revision('some-path', '12345'), '2013- 02-08T09:55:21Z')
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698