lemon-oxygen-72498
10/14/2022, 8:03 AMpants
š Could someone help me debug that pants test
passes correctly but pants check
(with mypy
) doesn't, because of an import
not found. I'm puzzled that imports are found in the test
task, but not with check
. My code structure is as follows:
āāā BUILD
āāā kaiko
ā āāā geometry
ā āāā *.py
āāā pyproject.toml
āāā requirements.txt
āāā tests
āāā BUILD
āāā test_*.py
The top-level BUILD file is:
python_requirements(name="kaiko-geometry-reqs")
poetry_requirements(name="kaiko-geometry-poetry-reqs")
python_sources(
name="kaiko-geometry",
sources=["kaiko/geometry/**/*.py"],
dependencies=[
":kaiko-geometry-reqs#numpy",
],
)
The BUILD file in tests
is:
python_tests(
name="kaiko-geometry-tests",
dependencies=[
"//:dev-reqs", # Top-level repo deps: pytest for example
"libs/geometry:kaiko-geometry-reqs",
"libs/geometry:kaiko-geometry",
],
)
python_test_utils(
name="kaiko-geometry-test-utils",
dependencies=[
"//:dev-reqs", # Top-level repo deps: pytest for example
"libs/geometry:kaiko-geometry-reqs",
"libs/geometry:kaiko-geometry",
],
)
The libs/geometry
paths in the second BUILD file come from the fact that all this stuff is at libs/geometry
in the enclosing repo.