Hello! I've a monorepo laid out as such:
mondo - root of the monorepo where there is a
pyenv dedicated to the 'top' of this repo and
pants installed via bootstrap (
mondo-3.8.10 via mondo/.python-project)
mondo/src/python/project1 - this project as it's own
pyenv (
project1-3.8.10 via mondo/src/python/project1/.python-project)
mondo/tests/python/project1 - this dir
uses the same pyenv as src/python/project1 via mondo/tests/python/project1/.python-project with name project1-3.8.10)
pyenv
mondo-3.8.10 is a minimal pyenv containing only modules to support pants. pyenv
project1-3.8.10 contains all of the required modules for coding project1. In my case the AWS Boto3 modules.
pyenv activates/deactivates correctly in the terminal when cd'ing into/out of the venv - so, the local dir
.python-version is, I'm presuming, accurate for
pants purposes.
Most every other goal appears to use the
project1 pyenv for the stated goal. e.g. ~/mondo:*./pants package src/python/project1:dist* or
./pants typecheck src/python/project1 all complete successfully.
However, when I attempt the
test goal the tests fail with modules not found. e.g. ~/mondo:*./pants test tests/python/project1:tests* fails.
Tried:
⢠*
pants.to*ml interpreter_search_paths = ["<PATH>", "<PYENV_LOCAL>", "<PYENV>"] and
exporti PATH=/home/x/.pyenv/versions/project1-3.8.10/bin:$PATH
⢠*
pants.to*ml interpreter_search_paths = ["*/home/x/.pyenv/versions/project1-3.8.10/bin"*]
⢠Copy
tests/python/project1 to
src/python/project1/tests and setting BUILD in
src/python/project1
python_tests(
name="tests",
sources = [
"tests/*_test.py",
"tests/*_tests.py",
"tests/*_test.pyi",
"tests/*_tests.pyi",
],
)
~/mondo:*./pants src/python/project1:tests* tests fail with the same module not found errors.
I've confirmed the
project1-3.8.10 virtualenv has the modules (
mondo-3.8.10 does not have them nor should ever need them). Via a terminal, if I cd to
~/mondo/tests/python/project1 the pyenv
project1-3.8.10 is activated. Then *pytest
_test.py completes successfully for all tests.
I've searched Pants documentation,
https://github.com/pantsbuild/pants/issues and this Slack account but I've not found anything illuminating.
When, running a
test goal - is it a correct assumption that the target pyenv should be used for the tests?
Are there any flagrant missteps I've done that would prevent an independent projects tests not to execute under the projects venv?
Has anyone else had similar issues?
Is the next step opening an issue in GitHub? If so, are there any particular artifacts or information to include beyond what I've described?
Thank you!