OLD | NEW |
(Empty) | |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. |
| 4 |
| 5 import unittest |
| 6 import os |
| 7 |
| 8 from gpu_tests import path_util |
| 9 |
| 10 path_util.AddDirToPathIfNeeded( |
| 11 path_util.GetChromiumSrcDir(), 'third_party', 'logilab') |
| 12 |
| 13 path_util.AddDirToPathIfNeeded( |
| 14 path_util.GetChromiumSrcDir(), 'third_party', 'logilab', 'logilab') |
| 15 |
| 16 path_util.AddDirToPathIfNeeded( |
| 17 path_util.GetChromiumSrcDir(), 'third_party', 'pylint') |
| 18 |
| 19 from pylint import lint |
| 20 |
| 21 |
| 22 _RC_FILE = os.path.join(path_util.GetGpuTestDir(), 'pylintrc') |
| 23 def LintCheckPassed(directory): |
| 24 args = [directory, '--rcfile=%s' % _RC_FILE] |
| 25 try: |
| 26 lint.Run(args) |
| 27 assert False, ( |
| 28 'This should not be reached as lint.Run always raise SystemExit') |
| 29 except SystemExit as err: |
| 30 if err.code == 0: |
| 31 return True |
| 32 return False |
| 33 |
| 34 class LintTest(unittest.TestCase): |
| 35 |
| 36 def testPassingPylintCheckForGpuTestsDir(self): |
| 37 self.assertTrue(LintCheckPassed(os.path.abspath(os.path.dirname(__file__)))) |
| 38 |
| 39 def testPassingPylintCheckForPageSetsDir(self): |
| 40 self.assertTrue(LintCheckPassed( |
| 41 os.path.join(os.path.abspath(os.path.dirname(__file__)), '..', 'page_sets' |
| 42 ))) |
OLD | NEW |