test/unittest_checkers_jslint.py
author Julien Cristau <julien.cristau@logilab.fr>
Wed, 09 Jul 2014 11:36:06 +0200
changeset 1547 9012705e9076
parent 1501 a45f5a997ab2
permissions -rw-r--r--
[narval/debcheck] use a glob instead of a recursive os.walk to find *.changes We know where those files are, there's no need to do a recursive search. This also avoids issues with os.walk with non-ascii file names. ***

#!/usr/bin/python

from logilab.common.testlib import TestSuite, TestCase, unittest_main
from unittest_checkers import FileCheckerTest, WRITER

try:
    import cubes.apycot
    from checkers.apycot.jslint import JsLintChecker, JsLintParser

    def load_tests(loader, tests, pattern):
        testsuite = TestSuite()
        addTest = testsuite.addTest
        # JSLint
        js_lint = JsLintChecker(WRITER)
        addTest(FileCheckerTest(js_lint, ['jscript/correct'], 'chks_test_dir_success'))

        addTest(FileCheckerTest(js_lint, ['jscript/bad/',],
                                'chks_test_dir_failure'))
        return testsuite

except ImportError:
    class NoTest(TestCase):
        def test(self):
            self.skipTest('install rhino to enable jslint')


if __name__ == '__main__':
    unittest_main()