Skip to content

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

@geaden

Description

@geaden

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions