cool-easter-32542
12/15/2023, 8:36 AMpytest, and using pytest-dotenv to setup some environment for pytest to work, for example MYSQL_DB_HOST.
My agent/build file look like this:
resources(name="test_env", sources=[".test.env"])
poetry_requirements(name="poetry_deps")
python_sources(name="agent", sources=["app/**/*.py"], dependencies=[":poetry_deps"])
python_sources(name="test_agent", sources=["tests/**/*.py"])
python_tests(name="tests", sources=["tests/**/test_*.py"], dependencies=[":agent", ":test_agent", ":test_env"])
But current the .test.env seems not load. I have save and enter the sandbox diretory. Run pytest in the sandbox with virtualenv is working. But the pants complains about the MYSQL_DB_HOST not defined. I am guess the problem is that pants run command in wrong directory or with wrong paramters. But I have no idea to figure out what exactly the pants run. This add too much difficulty on debug and fix issues.
I am sorry If I miss somthing in the doc. But I checkout the pants document without ways to do such things.
It will be nice to be able to see what the pants really execute.
pantsbuild/pants