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

Unified Diff: tools/perf/core/find_dependencies_unittest.py

Issue 2933163002: Revert of Remove find_dependencies script (Closed)
Patch Set: Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/perf/core/find_dependencies.py ('k') | tools/perf/find_dependencies » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/perf/core/find_dependencies_unittest.py
diff --git a/tools/perf/core/find_dependencies_unittest.py b/tools/perf/core/find_dependencies_unittest.py
new file mode 100644
index 0000000000000000000000000000000000000000..b0de97262e4de23d36c3820ceb3ed4bce9a022c9
--- /dev/null
+++ b/tools/perf/core/find_dependencies_unittest.py
@@ -0,0 +1,48 @@
+# Copyright 2014 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import os
+import unittest
+
+from telemetry.core import util
+
+from core import find_dependencies
+
+
+class FindDependenciesTest(unittest.TestCase):
+
+ def testFindPythonDependencies(self):
+ try:
+ dog_object_path = os.path.join(
+ util.GetUnittestDataDir(),
+ 'dependency_test_dir', 'dog', 'dog', 'dog_object.py')
+ cat_module_path = os.path.join(
+ util.GetUnittestDataDir(),
+ 'dependency_test_dir', 'other_animals', 'cat', 'cat')
+ cat_module_init_path = os.path.join(cat_module_path, '__init__.py')
+ cat_object_path = os.path.join(cat_module_path, 'cat_object.py')
+ self.assertEquals(
+ set(p for p in
+ find_dependencies.FindPythonDependencies(dog_object_path)),
+ {dog_object_path, cat_module_path, cat_module_init_path,
+ cat_object_path})
+ except ImportError: # crbug.com/559527
+ pass
+
+ def testFindPythonDependenciesWithNestedImport(self):
+ try:
+ moose_module_path = os.path.join(
+ util.GetUnittestDataDir(),
+ 'dependency_test_dir', 'other_animals', 'moose', 'moose')
+ moose_object_path = os.path.join(moose_module_path, 'moose_object.py')
+ horn_module_path = os.path.join(moose_module_path, 'horn')
+ horn_module_init_path = os.path.join(horn_module_path, '__init__.py')
+ horn_object_path = os.path.join(horn_module_path, 'horn_object.py')
+ self.assertEquals(
+ set(p for p in
+ find_dependencies.FindPythonDependencies(moose_object_path)),
+ {moose_object_path,
+ horn_module_path, horn_module_init_path, horn_object_path})
+ except ImportError: # crbug.com/559527
+ pass
« no previous file with comments | « tools/perf/core/find_dependencies.py ('k') | tools/perf/find_dependencies » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698