microscopic-receptionist-80998
06/05/2024, 9:58 AMbackend
- 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 ../
.refined-addition-53644
06/05/2024, 10:02 AMpython_test_utils
https://www.pantsbuild.org/2.20/reference/targets/python_test_utilsmicroscopic-receptionist-80998
06/05/2024, 10:08 AMmicroscopic-receptionist-80998
06/05/2024, 10:10 AMpython_test_utils
is intended to be used with python utility files so no .ini
or other files. Am I missing something?refined-addition-53644
06/05/2024, 10:16 AMrefined-addition-53644
06/05/2024, 10:37 AMalembic.ini
and alembic
inside tests/BUILD
microscopic-receptionist-80998
06/05/2024, 10:39 AMbackend/BUILD
file looks like this:
poetry_requirements(
name="backend",
resolve="backend",
)
resources(
name="alembic_resources",
sources=["alembic.ini", "alembic/**"],
)
and the one in backend/tests/BUILD
like this:
python_tests(
dependencies=[
"backend#asyncpg",
],
)
python_test_utils(
name="test_utils",
dependencies=[
"backend#psycopg2-binary",
"backend:alembic_resources",
],
)
microscopic-receptionist-80998
06/05/2024, 10:40 AM../alembic.ini
)refined-addition-53644
06/05/2024, 10:45 AM