test/unittest_checkers_jslint.py
author David Douard <david.douard@logilab.fr>
Sun, 26 Oct 2014 18:28:22 +0100
changeset 1766 42e60f760703
parent 1501 a45f5a997ab2
permissions -rw-r--r--
[checkers] rationalize the way project path is configured in checkers Generalize the use of the 'project_path' (mandatry) option in checkers

#!/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()