File tree Expand file tree Collapse file tree
src/pytest_databases/docker Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ Usage Example
2424 @pytest.fixture (scope = " session" )
2525 def yugabyte_uri (yugabyte_service : YugabyteService) -> str :
2626 opts = " &" .join(f " { k} = { v} " for k, v in yugabyte_service.driver_opts.items())
27- return f " postgresql://root @ { yugabyte_service.host} : { yugabyte_service.port} / { yugabyte_service.database} ? { opts} "
27+ return f " postgresql://yugabyte:yugabyte @ { yugabyte_service.host} : { yugabyte_service.port} / { yugabyte_service.database} ? { opts} "
2828
2929 def test_yugabyte_service (yugabyte_uri : str ) -> None :
3030 with psycopg.connect(yugabyte_uri) as conn:
Original file line number Diff line number Diff line change @@ -72,7 +72,7 @@ def yugabyte_responsive(_service: ServiceContainer) -> bool:
7272 check = yugabyte_responsive ,
7373 name = container_name ,
7474 command = "bin/yugabyted start --background=false" ,
75- exec_after_start = f'bin/ysqlsh -U yugabyte -c "CREATE DATABASE { db_name } ;"' ,
75+ exec_after_start = f"sh -c 'bin/ysqlsh -h $(hostname) - U yugabyte -d yugabyte -c \ " CREATE DATABASE { db_name } ;\" '" ,
7676 transient = xdist_yugabyte_isolation_level == "server" ,
7777 timeout = 60 , # YugabyteDB needs longer startup time
7878 ) as service :
Original file line number Diff line number Diff line change @@ -88,14 +88,16 @@ def xdist_yugabyte_isolation_level():
8888 def test_one(yugabyte_service) -> None:
8989 opts = "&".join(f"{k}={v}" for k, v in yugabyte_service.driver_opts.items())
9090 with psycopg.connect(
91- f"postgresql://yugabyte:yugabyte@{yugabyte_service.host}:{yugabyte_service.port}/{yugabyte_service.database}?{opts}"
91+ f"postgresql://yugabyte:yugabyte@{yugabyte_service.host}:{yugabyte_service.port}/{yugabyte_service.database}?{opts}",
92+ autocommit=True,
9293 ) as conn:
9394 conn.execute("CREATE DATABASE foo")
9495
9596 def test_two(yugabyte_service) -> None:
9697 opts = "&".join(f"{k}={v}" for k, v in yugabyte_service.driver_opts.items())
9798 with psycopg.connect(
98- f"postgresql://yugabyte:yugabyte@{yugabyte_service.host}:{yugabyte_service.port}/{yugabyte_service.database}?{opts}"
99+ f"postgresql://yugabyte:yugabyte@{yugabyte_service.host}:{yugabyte_service.port}/{yugabyte_service.database}?{opts}",
100+ autocommit=True,
99101 ) as conn:
100102 conn.execute("CREATE DATABASE foo")
101103 """ )
You can’t perform that action at this time.
0 commit comments