To address some problems with certain tests not cu...
# general
r
To address some problems with certain tests not currently working under Pants vs the current environment (probably related to parallelism?) I tried defining two
python_tests
in the directory that has the tests in question... ๐Ÿงต
Copy code
python_tests(
  name="test",
  source=[
    "test_*.py",
    "!test_that_is_deadlocking1.py",
    "!test_that_is_deadlocking2.py"
  ]
)

python_tests(
  name="deadlocking_tests",
  source=[
    "test_that_is_deadlocking1.py",
    "test_that_is_deadlocking2.py"
  ]
)
If I run
./pants test ::
then both the non-deadlocking and deadlocking tests are run.
I think I'm expecting to be able to
./pants test ::tests
or something like that to only run all targets in the whole tree named
tests
but that doesn't seem to work.
But both
./pants test directory/where/the/build/file/is:tests
and
./pants test directory/where/the/build/file/is:deadlocking_tests
do include the correct tests
h
path/to/dir::
rather than
::path/to/dir
r
If I run
./pants test test::
I'm still seeing
Copy code
Run Pytest for test/something/something/test_that_is_deadlocking1.py:deadlocking_tests
h
oh wait yeah that's expected -
test::
means all matching targets recursively under the dir
test
. If you want to run all those targets except for some, you could use tags https://www.pantsbuild.org/docs/advanced-target-selection#tags-annotating-targets (i also have a proposal to add ignore specs like
test:: !test/subdir::
)
r
I'd like to use tags, but https://github.com/pantsbuild/pants/issues/14977 ๐Ÿ˜‰
I can progress with a
--spec-files
instead I think
w
@rapid-exabyte-76685: fwiw, given that you have split into two generators like that, i think that tags should work fine. https://github.com/pantsbuild/pants/issues/14977 only affects
overrides
, afaict.
โœ… 1
r
yep that does indeed work ๐Ÿ‘ much cleaner than a
--spec-file
๐Ÿ‘ 1