OLD | NEW |
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 Loading... |
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 # Do not attempt to figure out python versions if |
| 81 # DO_NOT_RESTART_PYTHON_FOR_PYAUTO is set. |
| 82 if os.getenv('DO_NOT_RESTART_PYTHON_FOR_PYAUTO') is None: |
| 83 RunWithCorrectPythonIfNecessary() |
| 84 else: |
| 85 print 'Will not try to restart with the correct version of python '\ |
| 86 'as DO_NOT_RESTART_PYTHON_FOR_PYAUTO is set.' |
81 | 87 |
82 | 88 |
83 try: | 89 try: |
84 import pyauto | 90 import pyauto |
85 except ImportError: | 91 except ImportError: |
86 print >>sys.stderr, 'Cannot import pyauto from %s' % sys.path | 92 print >>sys.stderr, 'Cannot import pyauto from %s' % sys.path |
87 raise | 93 raise |
88 | 94 |
89 | 95 |
90 class Main(pyauto.Main): | 96 class Main(pyauto.Main): |
91 """Main program for running PyAuto functional tests.""" | 97 """Main program for running PyAuto functional tests.""" |
92 | 98 |
93 def __init__(self): | 99 def __init__(self): |
94 # Make scripts in this dir importable | 100 # Make scripts in this dir importable |
95 sys.path.append(os.path.dirname(__file__)) | 101 sys.path.append(os.path.dirname(__file__)) |
96 pyauto.Main.__init__(self) | 102 pyauto.Main.__init__(self) |
97 | 103 |
98 def TestsDir(self): | 104 def TestsDir(self): |
99 return os.path.dirname(__file__) | 105 return os.path.dirname(__file__) |
100 | 106 |
101 | 107 |
102 if __name__ == '__main__': | 108 if __name__ == '__main__': |
103 Main() | 109 Main() |
OLD | NEW |