File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
apps/bfd-pipeline/bfd-pipeline-idr Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -28,14 +28,16 @@ def _run_migrator(postgres: PostgresContainer) -> None:
2828 # Python recommends using an absolute path when running an executable
2929 # to avoid any ambiguity
3030 mvn = shutil .which ("mvn" ) or "mvn"
31+ test_dir = Path (__file__ ).parent
32+ migrator_dir = test_dir .parent .parent / "bfd-db-migrator-ng"
3133 try :
3234 subprocess .run (
3335 f"{ mvn } flyway:migrate "
3436 "-Dflyway.url="
3537 f"jdbc:postgresql://localhost:{ postgres .get_exposed_port (5432 )} /{ postgres .dbname } "
3638 f"-Dflyway.user={ postgres .username } "
3739 f"-Dflyway.password={ postgres .password } " ,
38- cwd = "../../bfd-db-migrator-ng" ,
40+ cwd = str ( migrator_dir ) ,
3941 shell = True ,
4042 capture_output = True ,
4143 check = True ,
@@ -47,14 +49,15 @@ def _run_migrator(postgres: PostgresContainer) -> None:
4749
4850@pytest .fixture (scope = "module" )
4951def setup_db () -> Generator [PostgresContainer ]:
52+ test_dir = Path (__file__ ).parent
5053 with PostgresContainer ("postgres:16" , driver = "" ) as postgres :
5154 with psycopg .connect (postgres .get_connection_url ()) as conn :
52- with Path ( "./ mock-idr.sql" ).open () as f :
55+ with ( test_dir / " mock-idr.sql" ).open () as f :
5356 conn .execute (f .read ()) # type: ignore
5457 conn .commit ()
5558
5659 _run_migrator (postgres )
57- load_from_csv (conn , "./ test_samples1" ) # type: ignore
60+ load_from_csv (conn , str ( test_dir / " test_samples1") ) # type: ignore
5861
5962 info = conn .info
6063 os .environ ["BFD_DB_ENDPOINT" ] = info .host
You can’t perform that action at this time.
0 commit comments