Hi! I'm wondering if this type of test configurati...
# general
p
Hi! I'm wondering if this type of test configuration is possible with pants: • I want for
pants test ::
to run unittests only, (so, for example, all tests not marked with tag='integration_test'), using certain set of env variables, and produce coverage. Right now env and coverage is configured in pants.toml using:
Copy code
[test]
use_coverage = true
extra_env_vars = ...
• I want
pants --tag=integration_test list ::
to run all integration tests only, with NO coverate, and with DIFFERENT environment variables config. Now, I know that I can probably achieve different environment variables configurations using different environments, and I can turn off coverage using
--test-use-coverage=false
for integration tests. That's fine, since they will be run by some bash script anyway, so I can live with complicated command to run them šŸ™‚ But is there a way for
pants test ::
to skip integration tests by default, or use some default tag without developers having to specify
pants test --tag="-integration_test" ::
to skip them? Thanks!
this may do it, so I think I've answered myself here... šŸ™‚
g
Aliases might be helpful here too - you can make a custom command which sets all the arguments you'd want for a specific workflow. I have these in my repo to override what default dependencies we use, for example.
Copy code
run-gpu = "--python-default-resolve=gpu run"
run-cpu = "--python-default-resolve=cpu run"
p
cool!
I missed that, thanks a lot šŸ™‚
g
Yepp! You can do the same thing with just flags as well; so you could do
pants test integration-tests
, where integration-tests expand to some flags/args. From the next version of Pants I've also added support for creating alias-like flags; so you could say
pants test --integration
and
pants test --unit
using aliases, for example.
ā¤ļø 2