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

Side by Side Diff: chrome/test/functional/pyauto_functional.py

Issue 10694077: Make PyAuto functional tests compatible with python 2.7 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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 | Annotate | Revision Log
« 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 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Setup for PyAuto functional tests. 6 """Setup for PyAuto functional tests.
7 7
8 Use the following in your scripts to run them standalone: 8 Use the following in your scripts to run them standalone:
9 9
10 # This should be at the top 10 # This should be at the top
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 RunAgain() 70 RunAgain()
71 71
72 # Check this is the right bitness on mac. 72 # Check this is the right bitness on mac.
73 # platform.architecture() will not help us on mac, since multiple binaries 73 # platform.architecture() will not help us on mac, since multiple binaries
74 # are stuffed inside the universal python binary. 74 # are stuffed inside the universal python binary.
75 if sys.platform.startswith('darwin') and sys.maxint > 2**32: 75 if sys.platform.startswith('darwin') and sys.maxint > 2**32:
76 # User is running 64-bit python, but we should use 32-bit. 76 # User is running 64-bit python, but we should use 32-bit.
77 RunAgain() 77 RunAgain()
78 78
79 79
80 RunWithCorrectPythonIfNecessary() 80 # Check the environment variable DO_NOT_RESTART_PYTHON_FOR_PYAUTO. If
Nirnimesh 2012/07/12 02:36:24 The comment is too long, and is explaining the cod
fdeng1 2012/07/12 03:47:52 Done.
81 # it is set (to any value), then do not try to run with the correct
82 # python(i.e. 2.6) regardless what the current python version is.
83 if os.getenv('DO_NOT_RESTART_PYTHON_FOR_PYAUTO') is None:
84 RunWithCorrectPythonIfNecessary()
85 else:
86 print 'Will not try to restart with the correct version of python '\
87 'as DO_NOT_RESTART_PYTHON_FOR_PYAUTO is set.'
81 88
82 89
83 try: 90 try:
84 import pyauto 91 import pyauto
85 except ImportError: 92 except ImportError:
86 print >>sys.stderr, 'Cannot import pyauto from %s' % sys.path 93 print >>sys.stderr, 'Cannot import pyauto from %s' % sys.path
87 raise 94 raise
88 95
89 96
90 class Main(pyauto.Main): 97 class Main(pyauto.Main):
91 """Main program for running PyAuto functional tests.""" 98 """Main program for running PyAuto functional tests."""
92 99
93 def __init__(self): 100 def __init__(self):
94 # Make scripts in this dir importable 101 # Make scripts in this dir importable
95 sys.path.append(os.path.dirname(__file__)) 102 sys.path.append(os.path.dirname(__file__))
96 pyauto.Main.__init__(self) 103 pyauto.Main.__init__(self)
97 104
98 def TestsDir(self): 105 def TestsDir(self):
99 return os.path.dirname(__file__) 106 return os.path.dirname(__file__)
100 107
101 108
102 if __name__ == '__main__': 109 if __name__ == '__main__':
103 Main() 110 Main()
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