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

Unified Diff: content/test/gpu/gpu_tests/lint_unittest.py

Issue 1920403002: [content/test/gpu] Run pylint check of gpu tests in unittest instead of PRESUBMIT (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update path to LICENSE.txt of logilab/README.chromium Created 4 years, 7 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 | « content/test/gpu/PRESUBMIT.py ('k') | content/test/gpu/pylintrc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/test/gpu/gpu_tests/lint_unittest.py
diff --git a/content/test/gpu/gpu_tests/lint_unittest.py b/content/test/gpu/gpu_tests/lint_unittest.py
new file mode 100644
index 0000000000000000000000000000000000000000..efc45c4eedb5aec2189438901e7d7c8402f44e30
--- /dev/null
+++ b/content/test/gpu/gpu_tests/lint_unittest.py
@@ -0,0 +1,48 @@
+# Copyright 2016 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 unittest
+import os
+
+from gpu_tests import path_util
+
+path_util.AddDirToPathIfNeeded(
+ path_util.GetChromiumSrcDir(), 'third_party', 'logilab')
+
+path_util.AddDirToPathIfNeeded(
+ path_util.GetChromiumSrcDir(), 'third_party', 'logilab', 'logilab')
+
+path_util.AddDirToPathIfNeeded(
+ path_util.GetChromiumSrcDir(), 'third_party', 'pylint')
+
+try:
+ from pylint import lint
+except ImportError:
+ lint = None
+
+
+_RC_FILE = os.path.join(path_util.GetGpuTestDir(), 'pylintrc')
+
+def LintCheckPassed(directory):
+ args = [directory, '--rcfile=%s' % _RC_FILE]
+ try:
+ assert lint, 'pylint module cannot be found'
+ lint.Run(args)
+ assert False, (
+ 'This should not be reached as lint.Run always raise SystemExit')
+ except SystemExit as err:
+ if err.code == 0:
+ return True
+ return False
+
+
+class LintTest(unittest.TestCase):
+
+ def testPassingPylintCheckForGpuTestsDir(self):
+ self.assertTrue(LintCheckPassed(os.path.abspath(os.path.dirname(__file__))))
+
+ def testPassingPylintCheckForPageSetsDir(self):
+ self.assertTrue(LintCheckPassed(
+ os.path.join(os.path.abspath(os.path.dirname(__file__)), '..', 'page_sets'
+ )))
« no previous file with comments | « content/test/gpu/PRESUBMIT.py ('k') | content/test/gpu/pylintrc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698