Skip to content
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

INTERNALERROR> ValueError '/path/to/test_runfiles/__init__.py' ("{!r} is not in the subpath of {!r}" #190

Open
geaden opened this issue Nov 7, 2023 · 1 comment

Comments

@geaden
Copy link

geaden commented Nov 7, 2023

I run pytest-pylint as part of bazel build inspired by this article.

Unfortunately, after updating to latest version of pytest-pylint, I'm getting:

INTERNALERROR>   File "//path/to/tools/tools/tools_test.runfiles/rules_python~0.24.0~pip~py_deps_311_pytest_pylint/site-packages/pytest_pylint/plugin.py", line 257, in <listcomp>
INTERNALERROR>     str((root_path / file_path).relative_to(getcwd()))
INTERNALERROR>         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/private/var/tmp/_bazel_geaden/6f98a3a65d0c1b35c4c31e9340fbc46d/execroot/_main/external/rules_python~0.24.0~python~python_3_11_aarch64-apple-darwin/lib/python3.11/pathlib.py", line 730, in relative_to
INTERNALERROR>     raise ValueError("{!r} is not in the subpath of {!r}"
INTERNALERROR> ValueError: '/path/to/tools/tools/tools_test.runfiles/__init__.py' is not in the subpath of '/path/to/tools/tools/tools_test.runfiles/_main' OR one path is relative and the other is absolute.

My pytest_wrapper.py:

if __name__ == "__main__":
  import os
  import pytest
  import sys
  dirs = set(map(os.path.dirname, sys.argv[1:]))
  for d in dirs:
    if not d in sys.path:
      sys.path.append(d)
  result = pytest.main(list(dirs))
  raise SystemExit(result)

pytest-pylint version 0.21.0
pytest version 7.4.3

This started to occurr after this changes 2a75f58#diff-e9aebdea893cd9c55222417aee3fa7c2579438f5b735a3ca7217b7a544f78bf9.

Any clues on how to resolve this?

@geaden
Copy link
Author

geaden commented Nov 7, 2023

There are some workarounds made in pytestfakefs pytest-dev/pyfakefs#828. Maybe they are related

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

1 participant