-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: fix formatting in extension tests
- Loading branch information
Showing
13 changed files
with
397 additions
and
234 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,7 +29,9 @@ def does_test_db_exist(cur: psycopg.Cursor) -> bool: | |
|
||
|
||
def drop_test_db(cur: psycopg.Cursor) -> None: | ||
cur.execute("select pg_terminate_backend(pid) from pg_stat_activity where datname = 'test'") | ||
cur.execute( | ||
"select pg_terminate_backend(pid) from pg_stat_activity where datname = 'test'" | ||
) | ||
cur.execute("drop database test with (force)") | ||
|
||
|
||
|
@@ -42,12 +44,16 @@ def create_test_db(cur: psycopg.Cursor) -> None: | |
@pytest.fixture(scope="session", autouse=True) | ||
def set_up_test_db() -> None: | ||
# create a test user and test database owned by the test user | ||
with psycopg.connect("postgres://[email protected]:5432/postgres", autocommit=True) as con: | ||
with psycopg.connect( | ||
"postgres://[email protected]:5432/postgres", autocommit=True | ||
) as con: | ||
with con.cursor() as cur: | ||
create_test_user(cur) | ||
create_test_db(cur) | ||
# grant some things to the test user in the test database | ||
with psycopg.connect("postgres://[email protected]:5432/test", autocommit=True) as con: | ||
with psycopg.connect( | ||
"postgres://[email protected]:5432/test", autocommit=True | ||
) as con: | ||
with con.cursor() as cur: | ||
cur.execute("grant execute on function pg_read_binary_file(text) to test") | ||
cur.execute("grant pg_read_server_files to test") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.