OLD | NEW |
---|---|
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 | 2 |
3 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 """Setup for PyAuto media tests. | 7 """Setup for PyAuto media tests. |
8 | 8 |
9 Use the following in your scripts to run them standalone: | 9 Use the following in your scripts to run them standalone: |
10 | 10 |
11 # This should be at the top | 11 # This should be at the top |
12 import pyauto_media | 12 import pyauto_media |
13 | 13 |
14 if __name__ == '__main__': | 14 if __name__ == '__main__': |
15 pyauto_media.Main() | 15 pyauto_media.Main() |
16 | 16 |
17 This script looks similar to pyauto_functional.py. However, unlike | 17 This script looks similar to pyauto_functional.py. However, unlike |
18 pyauto_functional, this script can NOT be used as an executable to | 18 pyauto_functional, this script can NOT be used as an executable to |
19 fire off other media scripts since media tests require additional | 19 fire off other media scripts since media tests require additional |
20 parameters to be set in the form of environment variables (unless you | 20 parameters to be set in the form of environment variables (unless you |
21 want these variables to be defaults, which is generally not a good | 21 want these variables to be defaults, which is generally not a good |
22 idea). | 22 idea). |
23 """ | 23 """ |
24 | 24 |
25 import os | 25 import os |
26 import sys | 26 import sys |
27 | 27 |
28 from media_test_env_names import MediaTestEnvNames | |
29 | |
30 # Define the location of the binary used for reference build | |
dennis_jeffrey
2011/05/19 01:20:13
Add period at the end of this sentence.
imasaki1
2011/05/20 05:12:01
Done.
| |
31 # TODO(imasaki): change this directory once reference build | |
32 # directory is set. | |
33 REFERENCE_BUILD_DIR = os.path.join('/tmp','chrome-linux') | |
28 | 34 |
29 def _SetupPaths(): | 35 def _SetupPaths(): |
30 """Setting path to find pyauto_functional.py.""" | 36 """Setting path to find pyauto_functional.py.""" |
31 media_dir = os.path.abspath(os.path.dirname(__file__)) | 37 media_dir = os.path.abspath(os.path.dirname(__file__)) |
32 sys.path.append(media_dir) | 38 sys.path.append(media_dir) |
33 sys.path.append(os.path.normpath(os.path.join(media_dir, os.pardir))) | 39 sys.path.append(os.path.normpath(os.path.join(media_dir, os.pardir))) |
34 sys.path.append(os.path.normpath(os.path.join( | 40 sys.path.append(os.path.normpath(os.path.join( |
35 media_dir, os.pardir, os.pardir, os.pardir, os.pardir, | 41 media_dir, os.pardir, os.pardir, os.pardir, os.pardir, |
36 'third_party', 'psutil'))) | 42 'third_party', 'psutil'))) |
43 # Setting PYTHONPATH for reference build | |
dennis_jeffrey
2011/05/19 01:20:13
Add period at the end of this sentence.
imasaki1
2011/05/20 05:12:01
Done.
| |
44 if eval(os.getenv(MediaTestEnvNames.REFERENCE_BUILD_ENV_NAME)): | |
dennis_jeffrey
2011/05/19 01:20:13
(optional) I recommend adding a comment here that
Nirnimesh
2011/05/19 06:40:20
Don't eval.
Just:
if os.getenv(...):
sys.path.
imasaki1
2011/05/20 05:12:01
Done.
imasaki1
2011/05/20 05:12:01
Changed based on Nirnimesh's comments.
| |
45 sys.path.insert(0, REFERENCE_BUILD_DIR) | |
37 | 46 |
38 _SetupPaths() | 47 _SetupPaths() |
39 | 48 |
40 import pyauto_functional | 49 import pyauto_functional |
41 import pyauto | 50 import pyauto |
42 | 51 |
43 | 52 |
44 class Main(pyauto_functional.Main): | 53 class Main(pyauto_functional.Main): |
45 """Main program for running PyAuto media tests.""" | 54 """Main program for running PyAuto media tests.""" |
46 | 55 |
47 def __init__(self): | 56 def __init__(self): |
48 pyauto_functional.Main.__init__(self) | 57 pyauto_functional.Main.__init__(self) |
49 | 58 |
50 | 59 |
51 if __name__ == '__main__': | 60 if __name__ == '__main__': |
52 Main() | 61 Main() |
OLD | NEW |