summaryrefslogtreecommitdiffstats
path: root/chrome/test
diff options
context:
space:
mode:
authorkkania@chromium.org <kkania@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-05 18:36:49 +0000
committerkkania@chromium.org <kkania@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-05 18:36:49 +0000
commit8384b0f754ce76be1a670eb5467b68cb5842eb4b (patch)
tree49e2404fbc44b8b02e1e9b1655e8231d0907dff7 /chrome/test
parent9b0fa103f75698c83ea02eb659d0a34db823c6f0 (diff)
downloadchromium_src-8384b0f754ce76be1a670eb5467b68cb5842eb4b.zip
chromium_src-8384b0f754ce76be1a670eb5467b68cb5842eb4b.tar.gz
chromium_src-8384b0f754ce76be1a670eb5467b68cb5842eb4b.tar.bz2
Fix pyauto import tests with python2.6 on mac.
BUG=none TEST=none TBR=dennisjeffrey Review URL: http://codereview.chromium.org/8135035 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@104139 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test')
-rw-r--r--chrome/test/functional/imports.py33
1 files changed, 10 insertions, 23 deletions
diff --git a/chrome/test/functional/imports.py b/chrome/test/functional/imports.py
index 9ba8d3d..197a5ba 100644
--- a/chrome/test/functional/imports.py
+++ b/chrome/test/functional/imports.py
@@ -84,30 +84,17 @@ class ImportsTest(pyauto.PyUITest):
Creates |dir| if it doesn't exist.
"""
+ if not os.path.isdir(dir):
+ os.makedirs(dir)
zf = zipfile.ZipFile(profile_zip)
- # Make base.
- pushd = os.getcwd()
- try:
- if not os.path.isdir(dir):
- os.mkdir(dir)
- os.chdir(dir)
- # Extract files.
- for info in zf.infolist():
- name = info.filename
- if name.endswith('/'): # It's a directory.
- if not os.path.isdir(name):
- os.makedirs(name)
- else: # It's a file.
- dir = os.path.dirname(name)
- if dir and not os.path.isdir(dir):
- os.makedirs(dir)
- out = open(name, 'wb')
- out.write(zf.read(name))
- out.close()
- # Set permissions.
- os.chmod(name, 0777)
- finally:
- os.chdir(pushd)
+ for name in zf.namelist():
+ full_path = os.path.join(dir, name)
+ if name.endswith('/'):
+ if not os.path.isdir(full_path):
+ os.makedirs(full_path)
+ else:
+ zf.extract(name, dir)
+ os.chmod(full_path, 0777)
def _SwapFirefoxProfile(self):
"""Swaps the test Firefox profile with the original one."""