Considering the following folder structure: ```bac...
# general
m
Considering the following folder structure:
Copy code
backend
 - alembic
 - tests
   - BUILD
   - conftest.py
 - alembic.ini
 - BUILD
backend/BUILD
does contain 2 targets (
file
, and
files
) to copy the ini and the folder but they are used for creating the PEX during the
package
goal. How can one add fixtures (
alembic
folder and
alembic.ini
file) to tests? I tried to reference the 2 file goals in
backend/tests/BUILD
but it seems the files can still not be found by python and if I'm trying to add them using the
files
target inside
tests/BUILD
, pants complains that we should use the
../
.
r
m
I was editing to make clearer but it seems you beat me to it 🙂
@refined-addition-53644, I think
python_test_utils
is intended to be used with python utility files so no
.ini
or other files. Am I missing something?
r
Yeah that is only a helper for test related stuff.
how do your BUILD files look like? You should be able to add the dependency on the target which owns
alembic.ini
and
alembic
inside
tests/BUILD
m
The
backend/BUILD
file looks like this:
Copy code
poetry_requirements(
    name="backend",
    resolve="backend",
)

resources(
    name="alembic_resources",
    sources=["alembic.ini", "alembic/**"],
)
and the one in
backend/tests/BUILD
like this:
Copy code
python_tests(
    dependencies=[
        "backend#asyncpg",
    ],
)

python_test_utils(
    name="test_utils",
    dependencies=[
        "backend#psycopg2-binary",
        "backend:alembic_resources",
    ],
)
I think the files are packaged but maybe not where I'd expect them (in conftest.py I'd expect to access them at
../alembic.ini
)
r