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.

Activity

The-Compiler

The-Compiler commented on Mar 21, 2020

@The-Compiler
Member

Accessing writer never really was meant to be public, and thus was deprecated in 5.4, see #6784. However, that deprecation warning probably should be shown when trying to set it as well.

DomKennedy

DomKennedy commented on Mar 22, 2020

@DomKennedy
Author

Ah, indeed there is indeed already a bug report for this on pytest-sugar: Teemu/pytest-sugar#187

added
type: bugproblem that needs to be addressed
type: regressionindicates a problem that was introduced in a release which was working previously
on Mar 22, 2020
The-Compiler

The-Compiler commented on Mar 26, 2020

@The-Compiler
Member

Given that this is a regression, I still think there's something for pytest to fix here (adjusting the deprecated property so that setting the attribute still works), no? @nicoddemus what do you think?

RonnyPfannschmidt

RonnyPfannschmidt commented on Mar 26, 2020

@RonnyPfannschmidt
Member

there should be a setter that sets self._tw and warns

added a commit that references this issue on Mar 27, 2020
added a commit that references this issue on Mar 27, 2020

16 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

      Participants

      @blueyed@RonnyPfannschmidt@The-Compiler@DomKennedy

      Issue actions

        pytest >= 5.4.0 raises INTERNALERROR AttributeError with pytest-sugar installed · Issue #6951 · pytest-dev/pytest