OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import os | 5 import os |
6 import unittest | 6 import unittest |
7 | 7 |
8 from telemetry.core import util | 8 from telemetry.core import util |
9 from telemetry.internal.util import find_dependencies | 9 |
| 10 from core import find_dependencies |
10 | 11 |
11 | 12 |
12 class FindDependenciesTest(unittest.TestCase): | 13 class FindDependenciesTest(unittest.TestCase): |
13 def testFindPythonDependencies(self): | 14 def testFindPythonDependencies(self): |
14 dog_object_path = os.path.join( | 15 dog_object_path = os.path.join( |
15 util.GetUnittestDataDir(), | 16 util.GetUnittestDataDir(), |
16 'dependency_test_dir', 'dog', 'dog', 'dog_object.py') | 17 'dependency_test_dir', 'dog', 'dog', 'dog_object.py') |
17 cat_module_path = os.path.join( | 18 cat_module_path = os.path.join( |
18 util.GetUnittestDataDir(), | 19 util.GetUnittestDataDir(), |
19 'dependency_test_dir', 'other_animals', 'cat', 'cat') | 20 'dependency_test_dir', 'other_animals', 'cat', 'cat') |
20 cat_module_init_path = os.path.join(cat_module_path, '__init__.py') | 21 cat_module_init_path = os.path.join(cat_module_path, '__init__.py') |
21 cat_object_path = os.path.join(cat_module_path, 'cat_object.py') | 22 cat_object_path = os.path.join(cat_module_path, 'cat_object.py') |
22 self.assertEquals( | 23 self.assertEquals( |
23 set(p for p in find_dependencies.FindPythonDependencies(dog_object_path)), | 24 set(p for p in find_dependencies.FindPythonDependencies(dog_object_path)), |
24 {dog_object_path, cat_module_path, cat_module_init_path, cat_object_path}) | 25 {dog_object_path, cat_module_path, cat_module_init_path, cat_object_path}) |
25 | 26 |
26 def testFindPythonDependenciesWithNestedImport(self): | 27 def testFindPythonDependenciesWithNestedImport(self): |
27 moose_module_path = os.path.join( | 28 moose_module_path = os.path.join( |
28 util.GetUnittestDataDir(), | 29 util.GetUnittestDataDir(), |
29 'dependency_test_dir', 'other_animals', 'moose', 'moose') | 30 'dependency_test_dir', 'other_animals', 'moose', 'moose') |
30 moose_object_path = os.path.join(moose_module_path, 'moose_object.py') | 31 moose_object_path = os.path.join(moose_module_path, 'moose_object.py') |
31 horn_module_path = os.path.join(moose_module_path, 'horn') | 32 horn_module_path = os.path.join(moose_module_path, 'horn') |
32 horn_module_init_path = os.path.join(horn_module_path, '__init__.py') | 33 horn_module_init_path = os.path.join(horn_module_path, '__init__.py') |
33 horn_object_path = os.path.join(horn_module_path, 'horn_object.py') | 34 horn_object_path = os.path.join(horn_module_path, 'horn_object.py') |
34 self.assertEquals( | 35 self.assertEquals( |
35 set(p for p in | 36 set(p for p in |
36 find_dependencies.FindPythonDependencies(moose_object_path)), | 37 find_dependencies.FindPythonDependencies(moose_object_path)), |
37 {moose_object_path, | 38 {moose_object_path, |
38 horn_module_path, horn_module_init_path, horn_object_path}) | 39 horn_module_path, horn_module_init_path, horn_object_path}) |
OLD | NEW |