Skip to content

[pytest 3.4.0] 'NoneType' object has no attribute 'testscollected' #3170

@sfdye

Description

@sfdye

Our project depends on pytest-django which has a dependency on pytest (>=2.9). After pytest was upgraded to the latest version 3.4.0, all of our tests failed on CircleCI.

If I revert back to pytest==3.3.2, the tests will pass again.

Is there something new breaking the build?
https://docs.pytest.org/en/latest/changelog.html#changelog

Here is the full stack trace:

Test session starts (platform: linux, Python 3.5.4, pytest 3.4.0, pytest-sugar 0.9.0)
Django settings: config.settings.test (from ini file)
rootdir: /home/circleci/XXX, inifile: pytest.ini
plugins: sugar-0.9.0, django-3.1.2, cov-2.5.1, celery-4.1.0

INTERNALERROR> Traceback (most recent call last):
INTERNALERROR> File "/home/circleci/XXX/venv/lib/python3.5/site-packages/_pytest/main.py", line 100, in wrap_session
INTERNALERROR> session.exitstatus = doit(config, session) or 0
INTERNALERROR> File "/home/circleci/XXX/venv/lib/python3.5/site-packages/_pytest/main.py", line 138, in _main
INTERNALERROR> config.hook.pytest_runtestloop(session=session)
INTERNALERROR> File "/home/circleci/XXX/venv/lib/python3.5/site-packages/pluggy/init.py", line 617, in call
INTERNALERROR> return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
INTERNALERROR> File "/home/circleci/XXX/venv/lib/python3.5/site-packages/pluggy/init.py", line 222, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR> File "/home/circleci/XXX/venv/lib/python3.5/site-packages/pluggy/init.py", line 216, in
INTERNALERROR> firstresult=hook.spec_opts.get('firstresult'),
INTERNALERROR> File "/home/circleci/XXX/venv/lib/python3.5/site-packages/pluggy/callers.py", line 196, in _multicall
INTERNALERROR> gen.send(outcome)
INTERNALERROR> File "/home/circleci/XXX/venv/lib/python3.5/site-packages/pluggy/callers.py", line 76, in get_result
INTERNALERROR> raise ex[1].with_traceback(ex[2])
INTERNALERROR> File "/home/circleci/XXX/venv/lib/python3.5/site-packages/pluggy/callers.py", line 180, in _multicall
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR> File "/home/circleci/XXX/venv/lib/python3.5/site-packages/_pytest/main.py", line 161, in pytest_runtestloop
INTERNALERROR> item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)
INTERNALERROR> File "/home/circleci/XXX/venv/lib/python3.5/site-packages/pluggy/init.py", line 617, in call
INTERNALERROR> return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
INTERNALERROR> File "/home/circleci/XXX/venv/lib/python3.5/site-packages/pluggy/init.py", line 222, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR> File "/home/circleci/XXX/venv/lib/python3.5/site-packages/pluggy/init.py", line 216, in
INTERNALERROR> firstresult=hook.spec_opts.get('firstresult'),
INTERNALERROR> File "/home/circleci/XXX/venv/lib/python3.5/site-packages/pluggy/callers.py", line 201, in _multicall
INTERNALERROR> return outcome.get_result()
INTERNALERROR> File "/home/circleci/XXX/venv/lib/python3.5/site-packages/pluggy/callers.py", line 76, in get_result
INTERNALERROR> raise ex[1].with_traceback(ex[2])
INTERNALERROR> File "/home/circleci/XXX/venv/lib/python3.5/site-packages/pluggy/callers.py", line 180, in _multicall
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR> File "/home/circleci/XXX/venv/lib/python3.5/site-packages/_pytest/runner.py", line 64, in pytest_runtest_protocol
INTERNALERROR> nodeid=item.nodeid, location=item.location,
INTERNALERROR> File "/home/circleci/XXX/venv/lib/python3.5/site-packages/pluggy/init.py", line 617, in call
INTERNALERROR> return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
INTERNALERROR> File "/home/circleci/XXX/venv/lib/python3.5/site-packages/pluggy/init.py", line 222, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR> File "/home/circleci/XXX/venv/lib/python3.5/site-packages/pluggy/init.py", line 216, in
INTERNALERROR> firstresult=hook.spec_opts.get('firstresult'),
INTERNALERROR> File "/home/circleci/XXX/venv/lib/python3.5/site-packages/pluggy/callers.py", line 201, in _multicall
INTERNALERROR> return outcome.get_result()
INTERNALERROR> File "/home/circleci/XXX/venv/lib/python3.5/site-packages/pluggy/callers.py", line 76, in get_result
INTERNALERROR> raise ex[1].with_traceback(ex[2])
INTERNALERROR> File "/home/circleci/XXX/venv/lib/python3.5/site-packages/pluggy/callers.py", line 180, in _multicall
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR> File "/home/circleci/XXX/venv/lib/python3.5/site-packages/_pytest/terminal.py", line 315, in pytest_runtest_logfinish
INTERNALERROR> last_item = len(self._progress_nodeids_reported) == self._session.testscollected
INTERNALERROR> AttributeError: 'NoneType' object has no attribute 'testscollected'

Results (21.32s):
1 passed
Exited with code 3

Metadata

Metadata

Assignees

No one assigned

    Labels

    plugin: loggingrelated to the logging builtin plugintype: regressionindicates a problem that was introduced in a release which was working previously

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions