pants
pants copied to clipboard
pants requires docker_execution to run local only goals over targets that require Docker
Describe the bug
Say you have some python unit tests that use a docker_environment
without a fallback to local (i.e. they require Docker), but you have docker_execution = false
by default set in your pants.toml
. If you try and run the fmt
or lint
goals over these targets you will get the following error:
Engine traceback:
in `fmt` goal
NoFallbackEnvironmentError: The global option `--docker-execution` is set to false, but the Docker environment `my_app_test_env` is used in my_app/tests/test_configs.pythe `environment` field of targets including , my_app/tests/test_ops.pythe `environment` field of targets including , my_app/tests/test_resources.py.
Either enable the option `--docker-execution`, or set the field `fallback_environment` for the target my_app/tests:environment.
However, these goals don't require docker and if you set docker_execution = true
you will get the following warning:
[WARN] The lint goal was called with targets including `my_app/tests/test_configs.py`, `my_app/tests/test_ops.py`, `my_app/tests/test_resources.py` (and others), which specify the environment `my_app_test_env`, which is a `docker_environment`. The lint goal only runs in the local environment. You may experience unexpected behavior.
These goals should just run even if docker_execution = false
.
Pants version 2.18.0
OS MacOS but I believe it is present on both.