pylint-bot / test

0 stars 0 forks source link

astroid 1.3.0 explodes on `import pytest` #55

Closed pylint-bot closed 8 years ago

pylint-bot commented 9 years ago

Originally reported by: Buck Evan (BitBucket: bukzor, GitHub: @bukzor?)


Workaround is pip install'<'1.3.0.

$ pylint simple_test.py
Traceback (most recent call last):
  File "/Users/buck/trees/yelp/venv-update/.tox/py27-lint/bin/pylint", line 9, in <module>
    load_entry_point('pylint==1.3.1', 'console_scripts', 'pylint')()
  File "/Users/buck/trees/yelp/venv-update/.tox/py27-lint/lib/python2.7/site-packages/pylint/__init__.py", line 21, in run_pylint
    Run(sys.argv[1:])
  File "/Users/buck/trees/yelp/venv-update/.tox/py27-lint/lib/python2.7/site-packages/pylint/lint.py", line 991, in __init__
    linter.check(args)
  File "/Users/buck/trees/yelp/venv-update/.tox/py27-lint/lib/python2.7/site-packages/pylint/lint.py", line 585, in check
    self.check_astroid_module(astroid, walker, rawcheckers, tokencheckers)
  File "/Users/buck/trees/yelp/venv-update/.tox/py27-lint/lib/python2.7/site-packages/pylint/lint.py", line 662, in check_astroid_module
    walker.walk(astroid)
  File "/Users/buck/trees/yelp/venv-update/.tox/py27-lint/lib/python2.7/site-packages/pylint/utils.py", line 804, in walk
    self.walk(child)
  File "/Users/buck/trees/yelp/venv-update/.tox/py27-lint/lib/python2.7/site-packages/pylint/utils.py", line 801, in walk
    cb(astroid)
  File "/Users/buck/trees/yelp/venv-update/.tox/py27-lint/lib/python2.7/site-packages/pylint/checkers/variables.py", line 756, in visit_import
    module = node.infer_name_module(parts[0]).next()
  File "/Users/buck/trees/yelp/venv-update/.tox/py27-lint/lib/python2.7/site-packages/astroid/bases.py", line 110, in cache_generator
    for result in generator:
  File "/Users/buck/trees/yelp/venv-update/.tox/py27-lint/lib/python2.7/site-packages/astroid/bases.py", line 341, in wrapped
    for res in _func(node, context, **kwargs):
  File "/Users/buck/trees/yelp/venv-update/.tox/py27-lint/lib/python2.7/site-packages/astroid/inference.py", line 212, in infer_import
    yield self.do_import_module(lookupname)
  File "/Users/buck/trees/yelp/venv-update/.tox/py27-lint/lib/python2.7/site-packages/astroid/mixins.py", line 107, in do_import_module
    return mymodule.import_module(modname, level=level)
  File "/Users/buck/trees/yelp/venv-update/.tox/py27-lint/lib/python2.7/site-packages/astroid/scoped_nodes.py", line 367, in import_module
    return MANAGER.ast_from_module_name(modname)
  File "/Users/buck/trees/yelp/venv-update/.tox/py27-lint/lib/python2.7/site-packages/astroid/manager.py", line 147, in ast_from_module_name
    return self.ast_from_file(filepath, modname, fallback=False)
  File "/Users/buck/trees/yelp/venv-update/.tox/py27-lint/lib/python2.7/site-packages/astroid/manager.py", line 109, in ast_from_file
    return AstroidBuilder(self).file_build(filepath, modname)
  File "/Users/buck/trees/yelp/venv-update/.tox/py27-lint/lib/python2.7/site-packages/astroid/builder.py", line 134, in file_build
    module = self._data_build(data, modname, path)
  File "/Users/buck/trees/yelp/venv-update/.tox/py27-lint/lib/python2.7/site-packages/astroid/builder.py", line 177, in _data_build
    module = rebuilder.visit_module(node, modname, node_file, package)
  File "/Users/buck/trees/yelp/venv-update/.tox/py27-lint/lib/python2.7/site-packages/astroid/rebuilder.py", line 148, in visit_module
    return self._transform(newnode)
  File "/Users/buck/trees/yelp/venv-update/.tox/py27-lint/lib/python2.7/site-packages/astroid/manager.py", line 324, in transform
    ret = transform_func(node)
  File "/Users/buck/trees/yelp/venv-update/.tox/py27-lint/lib/python2.7/site-packages/astroid/__init__.py", line 115, in transform
    for name, obj in extension_module.locals.items():
AttributeError: 'NoneType' object has no attribute 'locals'

$ cat simple_test.py
import pytest

$ pip freeze
PyYAML==3.11
argparse==1.2.2
aspy.yaml==0.2.0
astroid==1.3.0
cached-property==0.1.5
flake8==2.2.5
jsonschema==2.4.0
logilab-common==0.63.0
mccabe==0.2.1
nodeenv==0.11.1
ordereddict==1.1
pep8==1.5.7
pre-commit==0.3.2
py==1.4.26
pyflakes==0.8.1
pylint==1.3.1
pytest==2.6.4
simplejson==3.6.5
six==1.8.0
venv-update==0.0a2
virtualenv==1.11.6
wsgiref==0.1.2

pylint-bot commented 9 years ago

Original comment by BitBucket: jquast, GitHub: @jquast?:


Submitted Pull request #63

pylint-bot commented 9 years ago

Original comment by Claudiu Popa (BitBucket: PCManticore, GitHub: @PCManticore?):


return AstroidBuilder() value in py2pytest.py

This closes issue #55. function pytest_transform() fails to return any value, causing NoneType exception in register_module_extender().

pylint-bot commented 9 years ago

Original comment by Buck Evan (BitBucket: bukzor, GitHub: @bukzor?):


Please comment when this hits pypi. Thanks for the quick patch!

pylint-bot commented 9 years ago

Original comment by Torsten Marek (BitBucket: tmarek, GitHub: @tmarek?):


1.3.1 has been released, which contains the fix for this.

pylint-bot commented 9 years ago

Original comment by Torsten Marek (BitBucket: tmarek, GitHub: @tmarek?):


Issue #57 was marked as a duplicate of this issue.