[apycotlib] add a 'test_prefixes' config option for PyUnitTestChecker (closes #3241609)
authorDavid Douard <david.douard@logilab.fr>
Mon, 14 Oct 2013 16:49:34 +0200
changeset 1454 a3dcc0a1d6fa
parent 1453 3ca3071c2202
child 1455 4adba1b659f9
[apycotlib] add a 'test_prefixes' config option for PyUnitTestChecker (closes #3241609) so one can configure the prefixes of the files identified as test to be run
_apycotlib/checkers/python.py
--- a/_apycotlib/checkers/python.py	Mon Oct 14 16:47:11 2013 +0200
+++ b/_apycotlib/checkers/python.py	Mon Oct 14 16:49:34 2013 +0200
@@ -19,7 +19,7 @@
 from lxml import etree
 
 
-from logilab.common.testlib import find_tests
+from logilab.common.testlib import find_tests, DEFAULT_PREFIXES
 from logilab.common.modutils import get_module_files
 from logilab.common.decorators import cached
 from logilab.common.compat import any
@@ -341,6 +341,11 @@
             'help': ('comma separated list of directories where tests could be '
                      'find. Search in "test" and "tests" by default.'),
             },
+        'test_prefixes': {
+            'type': 'csv', 'default': DEFAULT_PREFIXES,
+            'help': ('comma separated list of directories where tests could be '
+                     'find. Defaults to %s.' % ', '.join(DEFAULT_PREFIXES)),
+            },
         })
 
     def do_check(self, test):
@@ -363,7 +368,9 @@
         """run a package test suite
         expect to be in the test directory
         """
-        tests = find_tests(testdir, remove_suffix=False)
+        tests = find_tests(testdir,
+                           prefixes=self.options.get("test_prefixes"),
+                           remove_suffix=False)
         if not tests:
             self.writer.error('no test found', path=self._path)
             return NODATA