Is there a way to use tags as an "opt in" behavior...
# general
h
Is there a way to use tags as an "opt in" behavior? For example, running
./pants test ::
wouldn't include certain tests unless you specifically called out their tags. I think in python, it's likely recommended to use pytest markers, but that can cause issues since
./pants test ::
with a pytest marker added would include a lot of modules that don't end up running any tests and then report a false failure.
n
You can add
tag = ["-tag_to_exclude"]
under
[GLOBAL]
in
pants.toml
. This’ll work as long as no one overrides it with
--tag
,
PANTS_TAG
etc.
b
https://github.com/pantsbuild/pants/issues/15012 is related, although doesn't provide much insight beyond pytest markers
h
Hmm that makes it seem like the above suggestion wouldn't work then?
n
I tested it a while ago.
pants --tag='+manual' lint path/to/manual/tests/::
as written in the issue does not work, but
pants --tag="['+manual']" lint path/to/manual/tests/::
does. But
tag = ["-manual"]
will also exclude it from everything, like
fmt
,
lint
etc., so it’s suboptimal if one only wants to exclude it from
test
.
👍 1
h
Gotcha. We only use
test
right now so I think we'd get by.