diff options
author | buck <buck@yelp.com> | 2013-10-14 17:49:21 -0700 |
---|---|---|
committer | buck <buck@yelp.com> | 2013-10-14 17:49:21 -0700 |
commit | c54c95b333603d345f1480e19ece1abe8f5f497b (patch) | |
tree | da1e9ede55d0d39143ee63428e2cea3d104511f7 /testutils.py | |
parent | e4fdc9058e72a8c7c3884e39a67f24b1bab939e7 (diff) | |
download | pylint-c54c95b333603d345f1480e19ece1abe8f5f497b.tar.gz |
Improve cyclic import detection in the case of packages.
Also, added support for input package in functional test.
Diffstat (limited to 'testutils.py')
-rw-r--r-- | testutils.py | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/testutils.py b/testutils.py index e939e51..6023fdd 100644 --- a/testutils.py +++ b/testutils.py @@ -22,7 +22,7 @@ import re from glob import glob from os import linesep -from os.path import abspath, dirname, join, basename, splitext +from os.path import abspath, basename, dirname, isdir, join, splitext from cStringIO import StringIO from logilab.common import testlib @@ -74,7 +74,8 @@ def get_tests_info(input_dir, msg_dir, prefix, suffix): if py_rest.isdigit() and SYS_VERS_STR >= py_rest: break else: - outfile = None + # This will provide an error message indicating the missing filename. + outfile = join(msg_dir, fbase + '.txt') result.append((infile, outfile)) return result @@ -263,7 +264,11 @@ class LintTestUsingFile(LintTestUsingModule): _TEST_TYPE = 'file' def test_functionality(self): - tocheck = [join(self.INPUT_DIR, self.module + '.py')] + importable = join(self.INPUT_DIR, self.module) + # python also prefers packages over simple modules. + if not isdir(importable): + importable += '.py' + tocheck = [importable] if self.depends: tocheck += [join(self.INPUT_DIR, name) for name, _file in self.depends] self._test(tocheck) @@ -294,8 +299,9 @@ def make_tests(input_dir, msg_dir, filter_rgx, callbacks): else: is_to_run = lambda x: 1 tests = [] - for module_file, messages_file in get_tests_info(input_dir, msg_dir, - 'func_', '.py'): + for module_file, messages_file in ( + get_tests_info(input_dir, msg_dir, 'func_', '') + ): if not is_to_run(module_file): continue base = module_file.replace('func_', '').replace('.py', '') |