-
Notifications
You must be signed in to change notification settings - Fork 211
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
LocalPath has no attribute startswith in pytest_load_initial_conftests #417
Comments
Not sure whose bug is this but I'll implement a workaround since this is also a regression. |
I did verify that this bug does not occur with pytest-cov 2.8.1 or 2.9.0, but does occur in 2.10.0. I also found a MWE that reproduces the issue. I created the file foo.py in an empty directory. class TestMWE(object):
def test_mwe(self, testdir):
"""
CommandLine:
pytest -p pytester foo.py
"""
w = testdir.maketxtfile(whatever="")
items, reprec = testdir.inline_genitems(w) Produces the following result:
Note this does seem to be caused by an interaction with the "testdir" fixture (god, I hate fixtures) from the builtin pytester plugin. It seems like they switched to using pathlib.Path objects, which is not handled correctly by pytest-cov, so it is a pytest-cov bug. |
Summary
In my latest version of xdoctest my dashboards are failing in pytest-cov with the error:
The traceback can be seen here:
https://app.circleci.com/pipelines/github/Erotemic/xdoctest/360/workflows/81333393-b945-4d01-9714-4039305e7dce/jobs/1856/steps
Expected vs actual result
I'm not sure if this is a pytest-cov error or not, pytest figures are incredibly hard to debug as they don't really allow for IPython embedding, and you can't make instances of them without running inside the pytest entry point. For whatever reason the
args
passed to the pytest-cov function:includes a non-string LocalPath object, which does not have the startswith method. If we simply force the arg to be a string by adding:
arg = str(arg)
as the first line of the loop everything works as expected.Any advice on if this is a pytest-cov bug, a pytest-bug, or a bug in the way I'm using them in xdoctest would be greatly appreciated. I can't seem to find anything in xdoctest that would trigger it, but I also don't see this error report anywhere else, so my suspicion is that its something on my end. But I guess it could also be that I'm the first one to find this, so I figured it wouldn't hurt to submit a bug report.
Reproducer
This can be reproduced by
Versions
The text was updated successfully, but these errors were encountered: