Pytest after running all tests raises AttributeError: 'ReprExceptionInfo' object has no attribute 'rsplit'

605 Views Asked by At

I use the pytest-django package for testing in the project. When running pytest for my Django project, I run into an exception that shows up after the whole tests have been ran, hence does not show the test results. This happened on OSX. The following is the complete stacktrace of the error. Nothing that leads back to my code whatsoever. Really frustrating.

Traceback (most recent call last):
  File "/Users/oluwanifemi/Desktop/projects/env/bin/pytest", line 8, in <module>
    sys.exit(console_main())
  File "/Users/oluwanifemi/Desktop/projects/env/lib/python3.8/site-packages/_pytest/config/__init__.py", line 187, in console_main
    code = main()
  File "/Users/oluwanifemi/Desktop/projects/env/lib/python3.8/site-packages/_pytest/config/__init__.py", line 164, in main
    ret = config.hook.pytest_cmdline_main(
  File "/Users/oluwanifemi/Desktop/projects/env/lib/python3.8/site-packages/pluggy/hooks.py", line 286, in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
  File "/Users/oluwanifemi/Desktop/projects/env/lib/python3.8/site-packages/pluggy/manager.py", line 93, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "/Users/oluwanifemi/Desktop/projects/env/lib/python3.8/site-packages/pluggy/manager.py", line 84, in <lambda>
    self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
  File "/Users/oluwanifemi/Desktop/projects/env/lib/python3.8/site-packages/pluggy/callers.py", line 187, in _multicall
    res = hook_impl.function(*args)
  File "/Users/oluwanifemi/Desktop/projects/env/lib/python3.8/site-packages/pluggy/callers.py", line 80, in get_result
    raise ex[1].with_traceback(ex[2])
  File "/Users/oluwanifemi/Desktop/projects/env/lib/python3.8/site-packages/pluggy/callers.py", line 187, in _multicall
    res = hook_impl.function(*args)
  File "/Users/oluwanifemi/Desktop/projects/env/lib/python3.8/site-packages/_pytest/main.py", line 306, in pytest_cmdline_main
    return wrap_session(config, _main)
  File "/Users/oluwanifemi/Desktop/projects/env/lib/python3.8/site-packages/_pytest/main.py", line 257, in wrap_session
    session.exitstatus = doit(config, session) or 0
  File "/Users/oluwanifemi/Desktop/projects/env/lib/python3.8/site-packages/pluggy/hooks.py", line 286, in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
  File "/Users/oluwanifemi/Desktop/projects/env/lib/python3.8/site-packages/pluggy/manager.py", line 93, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "/Users/oluwanifemi/Desktop/projects/env/lib/python3.8/site-packages/pluggy/manager.py", line 84, in <lambda>
    self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
  File "/Users/oluwanifemi/Desktop/projects/env/lib/python3.8/site-packages/pluggy/callers.py", line 208, in _multicall
    return outcome.get_result()
  File "/Users/oluwanifemi/Desktop/projects/env/lib/python3.8/site-packages/pluggy/callers.py", line 80, in get_result
    raise ex[1].with_traceback(ex[2])
  File "/Users/oluwanifemi/Desktop/projects/env/lib/python3.8/site-packages/pluggy/callers.py", line 187, in _multicall
    res = hook_impl.function(*args)
  File "/Users/oluwanifemi/Desktop/projects/env/lib/python3.8/site-packages/pytest_tldr.py", line 293, in pytest_sessionfinish
    self.print(report.longrepr)
  File "/Users/oluwanifemi/Desktop/projects/env/lib/python3.8/site-packages/pytest_tldr.py", line 124, in print
    self._tw.write(text)
  File "/Users/oluwanifemi/Desktop/projects/env/lib/python3.8/site-packages/_pytest/_io/terminalwriter.py", line 146, in write
    current_line = msg.rsplit("\n", 1)[-1]
AttributeError: 'ReprExceptionInfo' object has no attribute 'rsplit'

1

There are 1 best solutions below

3
On BEST ANSWER

Seems to be an issue with the pytest-tldr package.

Updating it to the latest version should fix the issue.