Skip to content

[bug] testpaths broken, captured as string #7814

@henryiii

Description

@henryiii

PyTest 6.1 has broken my CI. I'm using one plugin, pytest-benchmark. I get the following error:

2020-09-29T03:40:36.0792255Z ============================= test session starts ==============================
2020-09-29T03:40:36.0793910Z platform linux -- Python 3.8.5, pytest-6.1.0, py-1.9.0, pluggy-0.13.1
2020-09-29T03:40:36.0794803Z INTERNALERROR> Traceback (most recent call last):
2020-09-29T03:40:36.0796485Z INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.8.5/x64/lib/python3.8/site-packages/_pytest/main.py", line 255, in wrap_session
2020-09-29T03:40:36.0797505Z INTERNALERROR>     config.hook.pytest_sessionstart(session=session)
2020-09-29T03:40:36.0798805Z INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.8.5/x64/lib/python3.8/site-packages/pluggy/hooks.py", line 286, in __call__
2020-09-29T03:40:36.0799673Z INTERNALERROR>     return self._hookexec(self, self.get_hookimpls(), kwargs)
2020-09-29T03:40:36.0800832Z INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.8.5/x64/lib/python3.8/site-packages/pluggy/manager.py", line 93, in _hookexec
2020-09-29T03:40:36.0801697Z INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
2020-09-29T03:40:36.0802796Z INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.8.5/x64/lib/python3.8/site-packages/pluggy/manager.py", line 84, in <lambda>
2020-09-29T03:40:36.0803710Z INTERNALERROR>     self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
2020-09-29T03:40:36.0804893Z INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.8.5/x64/lib/python3.8/site-packages/pluggy/callers.py", line 208, in _multicall
2020-09-29T03:40:36.0805689Z INTERNALERROR>     return outcome.get_result()
2020-09-29T03:40:36.0806730Z INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.8.5/x64/lib/python3.8/site-packages/pluggy/callers.py", line 80, in get_result
2020-09-29T03:40:36.0807506Z INTERNALERROR>     raise ex[1].with_traceback(ex[2])
2020-09-29T03:40:36.0808525Z INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.8.5/x64/lib/python3.8/site-packages/pluggy/callers.py", line 187, in _multicall
2020-09-29T03:40:36.0809331Z INTERNALERROR>     res = hook_impl.function(*args)
2020-09-29T03:40:36.0810439Z INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.8.5/x64/lib/python3.8/site-packages/_pytest/terminal.py", line 700, in pytest_sessionstart
2020-09-29T03:40:36.0811401Z INTERNALERROR>     lines = self.config.hook.pytest_report_header(
2020-09-29T03:40:36.0812881Z INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.8.5/x64/lib/python3.8/site-packages/pluggy/hooks.py", line 286, in __call__
2020-09-29T03:40:36.0813748Z INTERNALERROR>     return self._hookexec(self, self.get_hookimpls(), kwargs)
2020-09-29T03:40:36.0814935Z INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.8.5/x64/lib/python3.8/site-packages/pluggy/manager.py", line 93, in _hookexec
2020-09-29T03:40:36.0821696Z INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
2020-09-29T03:40:36.0822958Z INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.8.5/x64/lib/python3.8/site-packages/pluggy/manager.py", line 84, in <lambda>
2020-09-29T03:40:36.0823891Z INTERNALERROR>     self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
2020-09-29T03:40:36.0825085Z INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.8.5/x64/lib/python3.8/site-packages/pluggy/callers.py", line 208, in _multicall
2020-09-29T03:40:36.0825879Z INTERNALERROR>     return outcome.get_result()
2020-09-29T03:40:36.0826913Z INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.8.5/x64/lib/python3.8/site-packages/pluggy/callers.py", line 80, in get_result
2020-09-29T03:40:36.0828102Z INTERNALERROR>     raise ex[1].with_traceback(ex[2])
2020-09-29T03:40:36.0829442Z INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.8.5/x64/lib/python3.8/site-packages/pluggy/callers.py", line 187, in _multicall
2020-09-29T03:40:36.0830278Z INTERNALERROR>     res = hook_impl.function(*args)
2020-09-29T03:40:36.0831433Z INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.8.5/x64/lib/python3.8/site-packages/_pytest/terminal.py", line 723, in pytest_report_header
2020-09-29T03:40:36.0832527Z INTERNALERROR>     rel_paths = [bestrelpath(config.rootpath, x) for x in testpaths]
2020-09-29T03:40:36.0833755Z INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.8.5/x64/lib/python3.8/site-packages/_pytest/terminal.py", line 723, in <listcomp>
2020-09-29T03:40:36.0834690Z INTERNALERROR>     rel_paths = [bestrelpath(config.rootpath, x) for x in testpaths]
2020-09-29T03:40:36.0835884Z INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.8.5/x64/lib/python3.8/site-packages/_pytest/pathlib.py", line 605, in bestrelpath
2020-09-29T03:40:36.0836705Z INTERNALERROR>     reldest = dest.relative_to(base)
2020-09-29T03:40:36.0837549Z INTERNALERROR> AttributeError: 'str' object has no attribute 'relative_to'

https://github.com/scikit-hep/boost-histogram/runs/1180071770?check_suite_focus=true

Pinning PyTest <6.1 fixes the issue.

I don't see a reason that pytest-benchmark should have broken from PyTest's changelog that correlates to the error here (though if it is intended, I can report there instead). Also can't swear it is PyTest-benchmark's fault, but I have other packages that have not broken.

Edit: looks like testpaths is not being read as a path. Also, getini does not specify the possible return types, otherwise MyPy could enforce handing then and likely caught this bug. I'm pretty much using the example from the docs for setup.cfg:

[tool:pytest]
junit_family=xunit2
addopts = --benchmark-disable -Wd
xfail_strict = True
testpaths =
    tests

I can add more details tomorrow if this is not enough.

  • a detailed description of the bug or problem you are having
  • output of pip list from the virtual environment you are using
  • pytest and operating system versions
  • minimal example if possible

Metadata

Metadata

Assignees

Labels

topic: reportingrelated to terminal output and user-facing messages and errorstype: 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