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

Unified Diff: tests/owners_unittest.py

Issue 9621012: Show a list of directories missing OWNER reviewers on upload, and show directories rather than file… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools/
Patch Set: Uncommented owners unit test Created 8 years, 9 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
Index: tests/owners_unittest.py
===================================================================
--- tests/owners_unittest.py (revision 125361)
+++ tests/owners_unittest.py (working copy)
@@ -44,6 +44,7 @@
'/chrome/renderer/safe_browsing/scorer.h': '',
'/content/OWNERS': owners_file(john, darin, comment='foo', noparent=True),
'/content/content.gyp': '',
+ '/content/bar/foo.cc': '',
'/content/views/OWNERS': owners_file(ben, john, owners.EVERYONE,
noparent=True),
})
@@ -128,7 +129,44 @@
self.assertRaises(AssertionError, db.files_not_covered_by, ['OWNERS'],
['foo'])
+ def assert_dirs_not_covered_by(self, files, reviewers, unreviewed_dirs):
+ db = self.db()
+ self.assertEquals(
+ db.directories_not_covered_by(set(files), set(reviewers)),
+ set(unreviewed_dirs))
+ def test_dirs_not_covered_by__need_at_least_one_reviewer(self):
+ self.assert_dirs_not_covered_by(['DEPS'], [], [''])
+
+ def test_dirs_not_covered_by__owners_propagates_down(self):
+ self.assert_dirs_not_covered_by(
+ ['chrome/gpu/gpu_channel.h', 'chrome/renderer/gpu/gpu_channel_host.h'],
+ [ben], [])
+
+ def test_dirs_not_covered_by__partial_covering(self):
+ self.assert_dirs_not_covered_by(
+ ['content/content.gyp', 'chrome/renderer/gpu/gpu_channel_host.h'],
+ [peter], ['content'])
+
+ def test_dirs_not_covered_by__set_noparent_works(self):
+ self.assert_dirs_not_covered_by(['content/content.gyp'], [ben],
+ ['content'])
+
+ def test_dirs_not_covered_by__combines_directories(self):
+ self.assert_dirs_not_covered_by(['content/content.gyp',
+ 'content/bar/foo.cc',
+ 'chrome/renderer/gpu/gpu_channel_host.h'],
+ [peter],
+ ['content'])
+
+ def test_dirs_not_covered_by__multiple_directories(self):
+ self.assert_dirs_not_covered_by(['content/content.gyp',
+ 'content/bar/foo.cc',
+ 'chrome/renderer/gpu/gpu_channel_host.h'],
+ [ken],
+ ['content'])
+
+
def assert_reviewers_for(self, files, expected_reviewers):
db = self.db()
self.assertEquals(db.reviewers_for(set(files)), set(expected_reviewers))

Powered by Google App Engine
This is Rietveld 408576698