Skip to content

pytest >= 5.4.0 raises INTERNALERROR AttributeError with pytest-sugar installed #6951

Closed
@DomKennedy

Description

@DomKennedy

With both 5.4.0 and 5.4.1, running pytest in the following environment:

``` $ pip list Package Version ------------------ ------- apipkg 1.5 attrs 19.3.0 coverage 5.0.4 execnet 1.7.1 importlib-metadata 1.5.0 more-itertools 8.2.0 packaging 20.3 pip 20.0.2 pluggy 0.13.1 py 1.8.1 pyparsing 2.4.6 pytest 5.4.1 pytest-cov 2.8.1 pytest-forked 1.1.3 pytest-html 2.1.1 pytest-metadata 1.8.0 pytest-sugar 0.9.2 pytest-xdist 1.31.0 setuptools 46.0.0 six 1.14.0 termcolor 1.1.0 wcwidth 0.1.8 wheel 0.34.2 zipp 3.1.0 ```

Raises the following error:

INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "~/foo/.venv/lib/python3.6/site-packages/_pytest/main.py", line 187, in wrap_session
INTERNALERROR>     config._do_configure()
:INTERNALERROR>   File "~/foo/.venv/lib/python3.6/site-packages/_pytest/config/__init__.py", line 820, in _do_configure
INTERNALERROR>     self.hook.pytest_configure.call_historic(kwargs=dict(config=self))
INTERNALERROR>   File "~/foo/.venv/lib/python3.6/site-packages/pluggy/hooks.py", line 308, in call_historic
INTERNALERROR>     res = self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR>   File "~/foo/.venv/lib/python3.6/site-packages/pluggy/manager.py", line 93, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR>   File "~/foo/.venv/lib/python3.6/site-packages/pluggy/manager.py", line 87, in <lambda>
INTERNALERROR>     firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
INTERNALERROR>   File "/~foo/.venv/lib/python3.6/site-packages/pluggy/callers.py", line 208, in _multicall
INTERNALERROR>     return outcome.get_result()
INTERNALERROR>   File "~/foo/.venv/lib/python3.6/site-packages/pluggy/callers.py", line 80, in get_result
INTERNALERROR>     raise ex[1].with_traceback(ex[2])
INTERNALERROR>   File "~/foo/.venv/lib/python3.6/site-packages/pluggy/callers.py", line 187, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "~/foo/.venv/lib/python3.6/site-packages/pytest_sugar.py", line 171, in pytest_configure
INTERNALERROR>     sugar_reporter = SugarTerminalReporter(standard_reporter)
INTERNALERROR>   File "~/foo/.venv/lib/python3.6/site-packages/pytest_sugar.py", line 209, in __init__
INTERNALERROR>    self.writer = self._tw
INTERNALERROR> AttributeError: can't set attribute

Note that the above environment is the result of installing the following requirements into a clean virtualenv:

pytest
pytest-cov
pytest-forked
pytest-html
pytest-metadata
pytest-sugar
pytest-xdist

Uninstalling pytest-sugar fixes the issue, as does downgrading pytest to 5.3.5.

I've experienced this error with python 3.6.8 on Ubuntu 18.04, and python 3.7.3 on macOS Catalina.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugproblem that needs to be addressedtype: 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