When you have multiple tests that need to query th...
# general
a
When you have multiple tests that need to query the same database container, we can use
PANTS_EXECUTION_SLOT
to ensure they create and connect to different databases on the server to prevent them from interfering with each other. Is there an easy way to set it up such that each file in a folder, e.g.
tests/integration
has an environment variable populated with the test's file name automatically? In this specific scenario I would like the environment variable
DB_NAME
to be set to
project-name-<name-of-test>
.
Answering my own question. It may very well be possible to do this in Pants, but I could also do it through the
request
fixture in Pytest using
request.path.stem
to get the name of the file. That solves the issue for me!
h
Yep, sounds like a job for a pytest plugin