Hi everyone, quick question! is there a way to run...
# general
p
Hi everyone, quick question! is there a way to run the test target (
pytest
) by module? I don't want one process per file, as I'm using the
@fixture(scope="session")
and I'd like it to apply to the entire module. I think scoping on the module doesn't work either because of pants' parallelization.
w
While I've never tried it, not that long ago another Pants user added this to the docs... Maybe a good place to start? Not quite per module, but perhaps this will lead somewhere useful. https://www.pantsbuild.org/docs/troubleshooting#controlling-test-parallelism
./pants --process-execution-local-parallelism=1 test ::
👀 1
h
h
Not to be a pedant, but just to clarify the question: a module in python is equivalent to a single file. Did you mean package?
p
(sorry for the late reply, this is a company project and my priorities are shifting a lot lately) Indeed I mean package, let's say I have a folder
tests/api/
with a BUILD file, a
conftest.py
and a
pytest.ini
file. I'd like to run all the tests contained in its sub-folder (i.e.
tests/api/a_tests/*.py
and
tests/api/b_tests/*.py
) in one single pants instance. Is this possibility already present? using the
--process-execution-local-parallelism=1
flag can work for us, as we want to prevent concurrent access to a common resource, it would be great to support it as one single run as I can't find a way to avoid rebuilding the entire resource for each package.