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

Unified Diff: tools/checkteamtags/extract_components_test.py

Issue 2648883002: Add coverage statistic (Closed)
Patch Set: update Docstring Created 3 years, 10 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/checkteamtags/extract_components.py ('k') | tools/checkteamtags/owners_file_tags.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/checkteamtags/extract_components_test.py
diff --git a/tools/checkteamtags/extract_components_test.py b/tools/checkteamtags/extract_components_test.py
index b9111659f4f1a1a7ed630e6ec7b503045de2e66a..0f99f4eab149c7239e9f586ebf26250f41c66e7f 100644
--- a/tools/checkteamtags/extract_components_test.py
+++ b/tools/checkteamtags/extract_components_test.py
@@ -124,3 +124,41 @@ class ExtractComponentsTest(unittest.TestCase):
output = saved_output.getvalue()
self.assertIn('src/OWNERS has no COMPONENT tag', output)
+ @mock_file_tree({
+ 'src': 'boss@chromium.org\n',
+ 'src/dummydir1': 'dummy@chromium.org\n'
+ '# TEAM: dummy-team@chromium.org\n'
+ '# COMPONENT: Dummy>Component',
+ 'src/dummydir2': 'dummy2@chromium.org\n'
+ '# COMPONENT: Dummy>Component',
+ 'src/dummydir1/innerdir1': 'dummy@chromium.org\n'
+ '# TEAM: dummy-specialist-team@chromium.org\n'
+ '# COMPONENT: Dummy>Component>Subcomponent'})
+ def testCoverage(self):
+ saved_output = StringIO()
+ with mock.patch('sys.stdout', saved_output):
+ extract_components.main(['%prog', '-s 2'])
+ output = saved_output.getvalue()
+ self.assertIn('4 OWNERS files in total.', output)
+ self.assertIn('3 (75.00%) OWNERS files have COMPONENT', output)
+ self.assertIn('2 (50.00%) OWNERS files have TEAM and COMPONENT', output)
+
+ @mock_file_tree({
+ 'src': 'boss@chromium.org\n',
+ 'src/dummydir1': 'dummy@chromium.org\n'
+ '# TEAM: dummy-team@chromium.org\n'
+ '# COMPONENT: Dummy>Component',
+ 'src/dummydir2': 'dummy2@chromium.org\n'
+ '# COMPONENT: Dummy>Component',
+ 'src/dummydir1/innerdir1': 'dummy@chromium.org\n'
+ '# TEAM: dummy-specialist-team@chromium.org\n'
+ '# COMPONENT: Dummy>Component>Subcomponent'})
+ def testCompleteCoverage(self):
+ saved_output = StringIO()
+ with mock.patch('sys.stdout', saved_output):
+ extract_components.main(['%prog', '-c'])
+ output = saved_output.getvalue()
+ self.assertIn('4 OWNERS files in total.', output)
+ self.assertIn('3 (75.00%) OWNERS files have COMPONENT', output)
+ self.assertIn('2 (50.00%) OWNERS files have TEAM and COMPONENT', output)
+ self.assertIn('4 OWNERS files at depth 0', output)
« no previous file with comments | « tools/checkteamtags/extract_components.py ('k') | tools/checkteamtags/owners_file_tags.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698