lemon-yak-80782
07/04/2023, 8:37 AM__defaults__(
{
(
python_sources,
python_source,
python_test,
python_tests,
python_test_utils,
): {"run_goal_use_sandbox": False}
}
)
in a part of my project. Now I have a issue that if I run a python source it works perfectly fine. All files I require during runtime (relative to the source) are found. If I run
pants test ::
The python_test
, python_tests
, and python test_utils
goals are still run in a sandbox. Hence, the tests fail because the paths can not be found.
Does anyone have a solution for this issue?refined-addition-53644
07/04/2023, 9:01 AM___defaults___
[python]
run_goal_use_sandbox = False
lemon-yak-80782
07/04/2023, 9:09 AMdefault_run_goal_use_sandbox = false
, same issue.refined-addition-53644
07/04/2023, 10:13 AMefault_run_goal_use_sandbox = false
in docs?lemon-yak-80782
07/04/2023, 10:14 AM[python]
default_run_goal_use_sandbox = false
This is the setting for the global python config: https://www.pantsbuild.org/docs/reference-python#basic-optionsrefined-addition-53644
07/04/2023, 10:17 AMlemon-yak-80782
07/04/2023, 10:18 AMrefined-addition-53644
07/04/2023, 10:20 AMrun
Run is generally used for running some application/binary
pants run <some.pex>
refined-addition-53644
07/04/2023, 10:20 AMpants run <test>
lemon-yak-80782
07/04/2023, 10:21 AMrefined-addition-53644
07/04/2023, 10:21 AMrefined-addition-53644
07/04/2023, 10:22 AMlemon-yak-80782
07/04/2023, 10:22 AMlemon-yak-80782
07/04/2023, 10:22 AMpython_tests
it is not implemented there.refined-addition-53644
07/04/2023, 10:22 AMrefined-addition-53644
07/04/2023, 10:23 AMlemon-yak-80782
07/04/2023, 10:23 AMlemon-yak-80782
07/04/2023, 10:25 AMuse_sandbox = false
.
Hence, one is not able to test sources supposed to be run outside of a sandbox.refined-addition-53644
07/04/2023, 10:25 AMlemon-yak-80782
07/04/2023, 10:30 AMpython_sources
or if they are handled at all. But as a user I would expect that if I set run_goal_use_sandbox = False
in a python_source
that python_test
would respect that configuration.refined-addition-53644
07/04/2023, 10:34 AMrun
and what is test
as a goal. run
is only applicable for python_sources
. The python_test
doc shouldn't mention its usage.
Whether such feature should exist or not, I would agree it should but it would be some other option like you said use_sandbox
or somethingrefined-addition-53644
07/04/2023, 10:35 AMlemon-yak-80782
07/04/2023, 10:46 AMtest
as a goal should test runnable goals. I will open an issue.bitter-ability-32190
07/04/2023, 1:11 PMpython <file.py>
. You can run any python files including test ones, so therefore it inherits the field
• The test goal specifically maps to running pytest on the file. And therefore the code isn't being run via the run goal and doesn't inherit this flag
• The run goal runs the process, no matter what. Therefore it's ok to run in your source tree, since we aren't trying to cache any results.
• The test goal is always run in the sandbox, because the results are cached. If we allowed running outside the sandbox, those cached values could be inconsistent with the state of your files, and that breaks a fundamental guarantee of Pants.lemon-yak-80782
07/04/2023, 3:02 PMbitter-ability-32190
07/04/2023, 3:12 PMlemon-yak-80782
07/04/2023, 3:36 PM