Skip to content

Error with Pytest 6.0.0 #321

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

Closed
brad-natelborg opened this issue Jul 29, 2020 · 6 comments
Closed

Error with Pytest 6.0.0 #321

brad-natelborg opened this issue Jul 29, 2020 · 6 comments

Comments

@brad-natelborg
Copy link

brad-natelborg commented Jul 29, 2020

With the latest version of Pytest coming out on 7/29/2020, I now get the following error in pytest-html:

INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/usr/local/lib/python3.5/dist-packages/_pytest/main.py", line 240, in wrap_session
INTERNALERROR>     session.exitstatus = doit(config, session) or 0
INTERNALERROR>   File "/usr/local/lib/python3.5/dist-packages/_pytest/main.py", line 296, in _main
INTERNALERROR>     config.hook.pytest_runtestloop(session=session)
INTERNALERROR>   File "/usr/local/lib/python3.5/dist-packages/pluggy/hooks.py", line 286, in __call__
INTERNALERROR>     return self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR>   File "/usr/local/lib/python3.5/dist-packages/pluggy/manager.py", line 93, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR>   File "/usr/local/lib/python3.5/dist-packages/pluggy/manager.py", line 87, in <lambda>
INTERNALERROR>     firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
INTERNALERROR>   File "/usr/local/lib/python3.5/dist-packages/pluggy/callers.py", line 208, in _multicall
INTERNALERROR>     return outcome.get_result()
INTERNALERROR>   File "/usr/local/lib/python3.5/dist-packages/pluggy/callers.py", line 80, in get_result
INTERNALERROR>     raise ex[1].with_traceback(ex[2])
INTERNALERROR>   File "/usr/local/lib/python3.5/dist-packages/pluggy/callers.py", line 187, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/usr/local/lib/python3.5/dist-packages/_pytest/main.py", line 321, in pytest_runtestloop
INTERNALERROR>     item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)
INTERNALERROR>   File "/usr/local/lib/python3.5/dist-packages/pluggy/hooks.py", line 286, in __call__
INTERNALERROR>     return self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR>   File "/usr/local/lib/python3.5/dist-packages/pluggy/manager.py", line 93, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR>   File "/usr/local/lib/python3.5/dist-packages/pluggy/manager.py", line 87, in <lambda>
INTERNALERROR>     firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
INTERNALERROR>   File "/usr/local/lib/python3.5/dist-packages/pluggy/callers.py", line 208, in _multicall
INTERNALERROR>     return outcome.get_result()
INTERNALERROR>   File "/usr/local/lib/python3.5/dist-packages/pluggy/callers.py", line 80, in get_result
INTERNALERROR>     raise ex[1].with_traceback(ex[2])
INTERNALERROR>   File "/usr/local/lib/python3.5/dist-packages/pluggy/callers.py", line 187, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/usr/local/lib/python3.5/dist-packages/_pytest/runner.py", line 100, in pytest_runtest_protocol
INTERNALERROR>     runtestprotocol(item, nextitem=nextitem)
INTERNALERROR>   File "/usr/local/lib/python3.5/dist-packages/_pytest/runner.py", line 111, in runtestprotocol
INTERNALERROR>     rep = call_and_report(item, "setup", log)
INTERNALERROR>   File "/usr/local/lib/python3.5/dist-packages/_pytest/runner.py", line 211, in call_and_report
INTERNALERROR>     hook.pytest_runtest_logreport(report=report)
INTERNALERROR>   File "/usr/local/lib/python3.5/dist-packages/pluggy/hooks.py", line 286, in __call__
INTERNALERROR>     return self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR>   File "/usr/local/lib/python3.5/dist-packages/pluggy/manager.py", line 93, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR>   File "/usr/local/lib/python3.5/dist-packages/pluggy/manager.py", line 87, in <lambda>
INTERNALERROR>     firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
INTERNALERROR>   File "/usr/local/lib/python3.5/dist-packages/pluggy/callers.py", line 208, in _multicall
INTERNALERROR>     return outcome.get_result()
INTERNALERROR>   File "/usr/local/lib/python3.5/dist-packages/pluggy/callers.py", line 80, in get_result
INTERNALERROR>     raise ex[1].with_traceback(ex[2])
INTERNALERROR>   File "/usr/local/lib/python3.5/dist-packages/pluggy/callers.py", line 187, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/usr/local/lib/python3.5/dist-packages/pytest_html/plugin.py", line 559, in pytest_runtest_logreport
INTERNALERROR>     self.append_skipped(report)
INTERNALERROR>   File "/usr/local/lib/python3.5/dist-packages/pytest_html/plugin.py", line 336, in append_skipped
INTERNALERROR>     self._appendrow("Skipped", report)
INTERNALERROR>   File "/usr/local/lib/python3.5/dist-packages/pytest_html/plugin.py", line 296, in _appendrow
INTERNALERROR>     result = self.TestResult(outcome, report, self.logfile, self.config)
INTERNALERROR>   File "/usr/local/lib/python3.5/dist-packages/pytest_html/plugin.py", line 137, in __init__
INTERNALERROR>     self.append_log_html(report, self.additional_html)
INTERNALERROR>   File "/usr/local/lib/python3.5/dist-packages/pytest_html/plugin.py", line 268, in append_log_html
INTERNALERROR>     for line in report.longreprtext.splitlines():
INTERNALERROR>   File "/usr/local/lib/python3.5/dist-packages/_pytest/reports.py", line 105, in longreprtext
INTERNALERROR>     self.toterminal(tw)
INTERNALERROR>   File "/usr/local/lib/python3.5/dist-packages/_pytest/reports.py", line 85, in toterminal
INTERNALERROR>     out.line(longrepr)
INTERNALERROR>   File "/usr/local/lib/python3.5/dist-packages/_pytest/_io/terminalwriter.py", line 168, in line
INTERNALERROR>     self.write(s, **markup)
INTERNALERROR>   File "/usr/local/lib/python3.5/dist-packages/_pytest/_io/terminalwriter.py", line 144, in write
INTERNALERROR>     current_line = msg.rsplit("\n", 1)[-1]
INTERNALERROR> AttributeError: 'tuple' object has no attribute 'rsplit'
@jorge-dev
Copy link

jorge-dev commented Jul 29, 2020

Having same Issue. In my case the error only happens when a test is skipped by using @pytest.mark.skipif.
Doing some digging I found the error is most likely originated from TestResult class inside pytest_html/plugin.py.
Commenting line 393 in same file allows the test to run and suppresses the error. However, the skipped tests will not be displayed in html report table.
https://github.com/pytest-dev/pytest-html/blob/master/pytest_html/plugin.py#L144
https://github.com/pytest-dev/pytest-html/blob/master/pytest_html/plugin.py#L393

image
image

@BeyondEvil
Copy link
Contributor

BeyondEvil commented Jul 30, 2020

Pin to latest 5 version, fix is coming in 6.0.1

@ssbarnea
Copy link
Member

Master already avoids 6.0.0 version and it does not make sense to force a release. We can close the bug as upstream one, one with simple workarounds.

@brad-natelborg
Copy link
Author

@ssbarnea When you say simple workarounds, are you just referring to using an older pytest version?

@ssbarnea
Copy link
Member

Take a look at https://github.com/pytest-dev/pytest-html/pull/319/files -- if I remember well, master branch of pytest already had it fixed, which means wait for 6.0.1 version. There is nothing else than skipping 6.0.0 from the pytest-html point of view.

Or just wait and likely it will sort-out by magic, when 6.0.1 is released ;)

To prevent future surprises I already proposed #320

@brad-natelborg
Copy link
Author

Got it, thanks!

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

4 participants