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

ignore_collect hook in conftest returning False causes infinite recursion #3825

Closed
3 tasks done
Sup3rGeo opened this issue Aug 17, 2018 · 1 comment
Closed
3 tasks done

Comments

@Sup3rGeo
Copy link
Member

  • Minimal example if possible

I have a project with the following layout:

image

All __init__ files are blank, except the internal conftest.py file with has the contents shown in the image.

Running it causes the following traceback:

(venv-clean-py) D:\WORK\pytest-collection-conftest-bug>pytest test
============================= test session starts =============================
platform win32 -- Python 3.6.3, pytest-3.7.1, py-1.5.4, pluggy-0.7.1
rootdir: D:\WORK\pytest-collection-conftest-bug, inifile:
collected 0 items / 1 errors                                                   

=================================== ERRORS ====================================
________ ERROR collecting test/integrations/rerunfailures/__init__.py _________
venv-clean-py\lib\site-packages\pluggy\hooks.py:258: in __call__
    return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
venv-clean-py\lib\site-packages\pluggy\manager.py:67: in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
venv-clean-py\lib\site-packages\pluggy\manager.py:61: in <lambda>
    firstresult=hook.spec_opts.get('firstresult'),
venv-clean-py\lib\site-packages\_pytest\python.py:210: in pytest_collect_file
    return ihook.pytest_pycollect_makemodule(path=path, parent=parent)
venv-clean-py\lib\site-packages\pluggy\hooks.py:258: in __call__
    return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
venv-clean-py\lib\site-packages\pluggy\manager.py:67: in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
venv-clean-py\lib\site-packages\pluggy\manager.py:61: in <lambda>
    firstresult=hook.spec_opts.get('firstresult'),
venv-clean-py\lib\site-packages\_pytest\python.py:215: in pytest_pycollect_makemodule
    return Package(path, parent)
venv-clean-py\lib\site-packages\_pytest\python.py:552: in __init__
    self, fspath, parent=parent, config=config, session=session, nodeid=nodeid
venv-clean-py\lib\site-packages\_pytest\nodes.py:351: in __init__
    fspath = py.path.local(fspath)  # xxx only for test_resultlog.py?
venv-clean-py\lib\site-packages\py\_path\local.py:158: in __init__
    self.strpath = abspath(path)
C:\Python36\lib\ntpath.py:551: in abspath
    return normpath(path)
C:\Python36\lib\ntpath.py:493: in normpath
    prefix, path = splitdrive(path)
C:\Python36\lib\ntpath.py:141: in splitdrive
    if len(p) >= 2:
E   RecursionError: maximum recursion depth exceeded in comparison
!!!!!!!!!!!!!!!!!!! Interrupted: 1 errors during collection !!!!!!!!!!!!!!!!!!!
=========================== 1 error in 2.44 seconds ===========================

Checking the pytest debug output (--debug), I see that this section gets repeated a billion times:

    genitems <Package 'D:\\WORK\\allure-python\\allure-pytest\\test\\integrations\\rerunfailures'> [collection]
      pytest_collectstart [hook]
          collector: <Package 'D:\\WORK\\allure-python\\allure-pytest\\test\\integrations\\rerunfailures'>
      finish pytest_collectstart --> [] [hook]
      pytest_make_collect_report [hook]
          collector: <Package 'D:\\WORK\\allure-python\\allure-pytest\\test\\integrations\\rerunfailures'>
        pytest_ignore_collect [hook]
            path: D:\WORK\allure-python\allure-pytest\test\integrations\rerunfailures\__pycache__
            config: <_pytest.config.Config object at 0x000002162E356DA0>
        finish pytest_ignore_collect --> False [hook]
        pytest_collect_directory [hook]
            path: D:\WORK\allure-python\allure-pytest\test\integrations\rerunfailures\__pycache__
            parent: <Package 'D:\\WORK\\allure-python\\allure-pytest\\test\\integrations\\rerunfailures'>
        finish pytest_collect_directory --> None [hook]
        pytest_ignore_collect [hook]
            path: D:\WORK\allure-python\allure-pytest\test\integrations\rerunfailures\__init__.py
            config: <_pytest.config.Config object at 0x000002162E356DA0>
        finish pytest_ignore_collect --> False [hook]
        pytest_collect_file [hook]
            path: D:\WORK\allure-python\allure-pytest\test\integrations\rerunfailures\__init__.py
            parent: <Package 'D:\\WORK\\allure-python\\allure-pytest\\test\\integrations\\rerunfailures'>
          pytest_pycollect_makemodule [hook]
              path: D:\WORK\allure-python\allure-pytest\test\integrations\rerunfailures\__init__.py
              parent: <Package 'D:\\WORK\\allure-python\\allure-pytest\\test\\integrations\\rerunfailures'>
          finish pytest_pycollect_makemodule --> <Package 'D:\\WORK\\allure-python\\allure-pytest\\test\\integrations\\rerunfailures'> [hook]
        finish pytest_collect_file --> [<DoctestModule '__init__.py'>, <Package 'D:\\WORK\\allure-python\\allure-pytest\\test\\integrations\\rerunfailures'>] [hook]
      finish pytest_make_collect_report --> <CollectReport 'test/integrations/rerunfailures/__init__.py' lenresult=2 outcome='passed'> [hook]
    genitems <DoctestModule '__init__.py'> [collection]
      pytest_collectstart [hook]
          collector: <DoctestModule '__init__.py'>
      finish pytest_collectstart --> [] [hook]
      pytest_make_collect_report [hook]
          collector: <DoctestModule '__init__.py'>
      finish pytest_make_collect_report --> <CollectReport 'test/integrations/rerunfailures/__init__.py' lenresult=0 outcome='passed'> [hook]
      pytest_collectreport [hook]
          report: <CollectReport 'test/integrations/rerunfailures/__init__.py' lenresult=0 outcome='passed'>
      find_module called for: termios [assertion]
      finish pytest_collectreport --> [] [hook]
  • pip list of the virtual environment you are using
atomicwrites (1.1.5)
attrs (18.1.0)
colorama (0.3.9)
more-itertools (4.3.0)
pip (9.0.1)
pluggy (0.7.1)
py (1.5.4)
pytest (3.7.1)
setuptools (28.8.0)
six (1.11.0)
  • pytest and operating system versions
  • pytest (3.7.1)
  • windows 10
@nicoddemus
Copy link
Member

Thanks @Sup3rGeo for the report.

This is fixed on master (#3771) and will be out soon (#3821). 👍

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