[code-quality] pylint unit tests?

Skip Montanaro skip at pobox.com
Thu Jul 4 03:22:42 CEST 2013


On Wed, Jul 3, 2013 at 5:57 PM, Martin Pool <mbp at google.com> wrote:
> They pass for me on Linux. It does not seem like the kind of thing that
> would be very platform-specific.

Thanks.  I tried to back out my local changes but eventually gave up,
not really understanding how this stuff works in Mercurial.  I wound
up just deleting my cloned repo at bitbucket as well and started from
scratch.  Cloned locally, and got to rev 1004.  I'm still getting a
number of errors, which seem to fall into one of two different types.
The first type is an AssertionError about 31 not being equal to 28:

FAIL: test_generated_members (smoketest.RunTC)
----------------------------------------------------------------------
Traceback (most recent call last)
  File "/Users/skip/local/lib/python2.7/site-packages/logilab_common-0.58.0-py2.7.egg/logilab/common/testlib.py",
line 644, in _proceed
    testfunc(*args, **kwargs)
  File "/Users/skip/src/pylint/test/smoketest.py", line 87, in
test_generated_members
    self._runtest(['--generated-members=objects,DoesNotExist,delay,retry,"[a-zA-Z]+_set{1,2}""',
'pylint.lint'])
  File "/Users/skip/src/pylint/test/smoketest.py", line 42, in _runtest
    self.assertEqual(ex.code, code)
  File "/Users/skip/local/lib/python2.7/unittest/case.py", line 515,
in assertEqual
    assertion_func(first, second, msg=msg)
  File "/Users/skip/local/lib/python2.7/unittest/case.py", line 508,
in _baseAssertEqual
    raise self.failureException(msg)
AssertionError: 31 != 28

The second is a more typical unit test failure, where the expected and
actual messages aren't equal:

FAIL: test_functionality (pylint.testutils.LintTC)
module test of input file "func_names_imported_from_module" (LintTC)
----------------------------------------------------------------------
Traceback (most recent call last)
  File "/Users/skip/local/lib/python2.7/site-packages/logilab_common-0.58.0-py2.7.egg/logilab/common/testlib.py",
line 644, in _proceed
    testfunc(*args, **kwargs)
  File "/Users/skip/local/lib/python2.7/site-packages/pylint-0.28.0-py2.7.egg/pylint/testutils.py",
line 232, in test_functionality
    self._test(tocheck)
  File "/Users/skip/local/lib/python2.7/site-packages/pylint-0.28.0-py2.7.egg/pylint/testutils.py",
line 249, in _test
    self.assertMultiLineEqual(got, self._get_expected())
  File "/Users/skip/local/lib/python2.7/unittest/case.py", line 926,
in assertMultiLineEqual
    self.fail(self._formatMessage(msg, standardMsg))
  File "/Users/skip/local/lib/python2.7/unittest/case.py", line 412, in fail
    raise self.failureException(msg)
AssertionError: "E:  6: No name 'common' in module 'logilab'\nE:  7:
No name 'common' in module  [truncated]... != "E:  6: No name 'tutu'
in module 'logilab.common'\nE:  7: No name 'toto' in modu
[truncated]...
- E:  6: No name 'common' in module 'logilab'
?                 ^^^^^^
+ E:  6: No name 'tutu' in module 'logilab.common'
?                 ^^^^                    +++++++
- E:  7: No name 'common' in module 'logilab'
?                 ^ ^^ -
+ E:  7: No name 'toto' in module 'logilab.common'
?                 ^ ^                     +++++++
- E: 10: No name 'common' in module 'logilab'
- E: 13: Module 'logilab' has no 'common' member
+ E: 11: Module 'logilab.common.modutils' has no 'nonexistant_function' member
+ E: 12: Module 'logilab.common.modutils' has no 'another' member
+ E: 13: Module 'logilab.common.modutils' has no 'yo' member
  E: 17: Module 'sys' has no 'stdoout' member
  E: 24: No name 'compiile' in module 're'
  E: 24: No name 'findiiter' in module 're'
  F:  6: Unable to import 'logilab.common.tutu'
- F:  7: Unable to import 'logilab.common'
- F: 10: Unable to import 'logilab.common'
  F: 23: Unable to import 'rie'
  W: 27: Statement seems to have no effect

As Martin indicated, there doesn't seem like there should be much in
the way of platform-specific stuff in pylint.  I tend to run Python
2.7.x built from the main Python repo:

% python
Python 2.7.5+ (2.7:5896f887a93a, Jul  3 2013, 20:04:47)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

Any advice cheerfully accepted...

Skip


More information about the code-quality mailing list