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

Side by Side Diff: appengine/findit/common/test/dependency_test.py

Issue 1154593005: [Findit] Add a sub-pipeline to analyze failures caused by DEPS rolls. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Improve readability. Created 5 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 unified diff | Download patch
OLDNEW
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 unittest 5 import unittest
6 6
7 from common.dependency import Dependency 7 from common.dependency import Dependency
8 from common.dependency import DependencyRoll
8 9
9 10
10 class DependencyTest(unittest.TestCase): 11 class DependencyTest(unittest.TestCase):
11 def testParentChild(self): 12 def testParentChild(self):
12 parent = Dependency( 13 parent = Dependency(
13 'a/', 'https://cr.googlesource.com/cr/a.git', '12a', 'DEPS') 14 'a/', 'https://cr.googlesource.com/cr/a.git', '12a', 'DEPS')
14 child = Dependency( 15 child = Dependency(
15 'a/b/', 'https://cr.googlesource.com/cr/b.git', '12b', 'DEPS') 16 'a/b/', 'https://cr.googlesource.com/cr/b.git', '12b', 'DEPS')
16 17
17 child.SetParent(parent) 18 child.SetParent(parent)
18 self.assertTrue(child.parent == parent) 19 self.assertTrue(child.parent == parent)
19 self.assertIn(child.path, parent.children) 20 self.assertIn(child.path, parent.children)
20 self.assertTrue(child == parent.children[child.path]) 21 self.assertTrue(child == parent.children[child.path])
21 22
22 def testToDict(self): 23 def testToDict(self):
23 root_dep = Dependency( 24 root_dep = Dependency(
24 'a/', 'https://cr.googlesource.com/cr/a.git', '12a', 'DEPS') 25 'a/', 'https://cr.googlesource.com/cr/a.git', '12a', 'DEPS')
25 sub_dep = Dependency( 26 sub_dep = Dependency(
26 'a/b/', 'https://cr.googlesource.com/cr/b.git', '12b', 'DEPS') 27 'a/b/', 'https://cr.googlesource.com/cr/b.git', '12b', 'DEPS')
27 expected_dep_tree_json = { 28 expected_dep_tree_dict = {
28 'path': 'a/', 29 'path': 'a/',
29 'repo_url': 'https://cr.googlesource.com/cr/a.git', 30 'repo_url': 'https://cr.googlesource.com/cr/a.git',
30 'revision': '12a', 31 'revision': '12a',
31 'deps_file': 'DEPS', 32 'deps_file': 'DEPS',
32 'children': { 33 'children': {
33 'a/b/': { 34 'a/b/': {
34 'path': 'a/b/', 35 'path': 'a/b/',
35 'repo_url': 'https://cr.googlesource.com/cr/b.git', 36 'repo_url': 'https://cr.googlesource.com/cr/b.git',
36 'revision': '12b', 37 'revision': '12b',
37 'deps_file': 'DEPS', 38 'deps_file': 'DEPS',
38 'children': { 39 'children': {
39 } 40 }
40 } 41 }
41 } 42 }
42 } 43 }
43 44
44 sub_dep.SetParent(root_dep) 45 sub_dep.SetParent(root_dep)
45 self.assertEqual(expected_dep_tree_json, root_dep.ToDict()) 46 self.assertEqual(expected_dep_tree_dict, root_dep.ToDict())
47
48
49 class DependencyRollTest(unittest.TestCase):
50 def testToDict(self):
51 dep_roll = DependencyRoll(
52 'third_party/dep/', 'https://cr.googlesource.com/cr/dep.git',
53 'rev1', 'rev2')
54 expected_dep_roll_dict = {
55 'path': 'third_party/dep/',
56 'repo_url': 'https://cr.googlesource.com/cr/dep.git',
57 'old_revision': 'rev1',
58 'new_revision': 'rev2',
59 }
60
61 self.assertEqual(expected_dep_roll_dict, dep_roll.ToDict())
OLDNEW
« no previous file with comments | « appengine/findit/common/test/chromium_deps_test.py ('k') | appengine/findit/waterfall/analyze_build_failure_pipeline.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698