summaryrefslogtreecommitdiff
path: root/testutils.py
diff options
context:
space:
mode:
authorbuck <buck@yelp.com>2014-03-05 15:54:03 -0800
committerbuck <buck@yelp.com>2014-03-05 15:54:03 -0800
commit67d3b24ed30ca18aac0842c46166c4c88dd4ea84 (patch)
tree53becbb7f6344144f2ec27e7162f0f0a6381b555 /testutils.py
parent8240a55ab1ccab81925197e0a196fcfd6eac5e2b (diff)
parentc54c95b333603d345f1480e19ece1abe8f5f497b (diff)
downloadpylint-67d3b24ed30ca18aac0842c46166c4c88dd4ea84.tar.gz
merge logilab tip to w0401_package
Diffstat (limited to 'testutils.py')
-rw-r--r--testutils.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/testutils.py b/testutils.py
index 16c8845..34f62fc 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
@@ -75,7 +75,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
@@ -268,7 +269,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)
@@ -299,8 +304,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', '')