Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Collection fails in python 2.6 if mock.call is imported #1103

Closed
dairiki opened this issue Oct 2, 2015 · 2 comments
Closed

Collection fails in python 2.6 if mock.call is imported #1103

dairiki opened this issue Oct 2, 2015 · 2 comments

Comments

@dairiki
Copy link

dairiki commented Oct 2, 2015

As of yet, I have no idea why this happens, but, using

  • python 2.6
  • mock 1.3.0
  • py.test 2.8.1 (or 2.8.0)

With test_mock.py containing the single line:

from mock import call

py.test test_mock.py fails with

============================= test session starts ==============================
platform linux2 -- Python 2.6.8, pytest-2.8.0, py-1.4.30, pluggy-0.3.1
rootdir: /srv/w/users/dairiki/git/discnw/btp_buildout, inifile: pytest.ini
collected 0 items / 1 errors 

==================================== ERRORS ====================================
______________________ ERROR collecting junk/test_mock.py ______________________
py26/lib/python2.6/site-packages/_pytest/runner.py:149: in __init__
    self.result = func()
py26/lib/python2.6/site-packages/_pytest/main.py:437: in _memocollect
    return self._memoizedcall('_collected', lambda: list(self.collect()))
py26/lib/python2.6/site-packages/_pytest/main.py:317: in _memoizedcall
    res = function()
py26/lib/python2.6/site-packages/_pytest/main.py:437: in <lambda>
    return self._memoizedcall('_collected', lambda: list(self.collect()))
py26/lib/python2.6/site-packages/_pytest/python.py:575: in collect
    return super(Module, self).collect()
py26/lib/python2.6/site-packages/_pytest/python.py:435: in collect
    l.sort(key=lambda item: item.reportinfo()[:2])
py26/lib/python2.6/site-packages/_pytest/python.py:435: in <lambda>
    l.sort(key=lambda item: item.reportinfo()[:2])
py26/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.26 seconds ============================

This same error seems to happen when collecting tests from any source which includes a from mock import call.

(This does not happen with pytest < 2.8. Also this does not seem to be a problem with python 2.7.)

@The-Compiler
Copy link
Member

Closing as a duplicate of #1035 and #1044.

@dairiki
Copy link
Author

dairiki commented Oct 2, 2015

Sorry for the dup. Thanks for the pointers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants