https://pantsbuild.org/ logo
h

high-yak-85899

04/17/2023, 5:15 PM
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

narrow-vegetable-37489

04/17/2023, 9:31 PM
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

broad-processor-92400

04/17/2023, 9:45 PM
https://github.com/pantsbuild/pants/issues/15012 is related, although doesn't provide much insight beyond pytest markers
h

high-yak-85899

04/17/2023, 10:08 PM
Hmm that makes it seem like the above suggestion wouldn't work then?
n

narrow-vegetable-37489

04/17/2023, 10:23 PM
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

high-yak-85899

04/17/2023, 10:58 PM
Gotcha. We only use
test
right now so I think we'd get by.
2 Views