Skip to content

from mock import call breaks test collector #1044

Closed
@lithammer

Description

@lithammer

To reproduce:

$ echo 'from mock import call' > test_foo.py
$ virtualenv env
$ ./env/bin/pip install pytest==2.8.0 mock==1.3.0
$ ./env/bin/py.test test_foo.py
========================== test session starts ==========================
platform darwin -- Python 2.6.6, pytest-2.8.0, py-1.4.30, pluggy-0.3.1
rootdir: /Users/Peter/src/github.com/edgeware, inifile:
collected 0 items / 1 errors

================================ ERRORS =================================
_____________________ ERROR collecting test_foo.py ______________________
env/lib/python2.6/site-packages/_pytest/runner.py:149: in __init__
    self.result = func()
env/lib/python2.6/site-packages/_pytest/main.py:437: in _memocollect
    return self._memoizedcall('_collected', lambda: list(self.collect()))
env/lib/python2.6/site-packages/_pytest/main.py:317: in _memoizedcall
    res = function()
env/lib/python2.6/site-packages/_pytest/main.py:437: in <lambda>
    return self._memoizedcall('_collected', lambda: list(self.collect()))
env/lib/python2.6/site-packages/_pytest/python.py:575: in collect
    return super(Module, self).collect()
env/lib/python2.6/site-packages/_pytest/python.py:435: in collect
    l.sort(key=lambda item: item.reportinfo()[:2])
env/lib/python2.6/site-packages/_pytest/python.py:435: in <lambda>
    l.sort(key=lambda item: item.reportinfo()[:2])
env/lib/python2.6/site-packages/_pytest/python.py:371: in reportinfo
    assert isinstance(lineno, int)
E   assert isinstance(compat_co_firstlineno, int)
======================== 1 error in 0.22 seconds ========================

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions