Skip to content

Commit b368877

Browse files
committed
Improve test_postgres_schema_delete_and_create
Verify that the table and schema still exists after Postgres refused to drop them.
1 parent 43765fe commit b368877

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

tests/test_schema.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,17 @@ def test_postgres_schema_delete_and_create():
8686
pg_error = extract_postgres_error(exc_info.value)
8787
assert pg_error.pgcode == errorcodes.DEPENDENT_OBJECTS_STILL_EXIST
8888

89+
# Verify that the schema and table still exist
90+
assert _does_schema_exist(schema.name)
91+
with connection.cursor() as cursor:
92+
cursor.execute("SELECT * FROM test.bla")
93+
assert cursor.fetchone() == ("hello",)
94+
8995
# Dropping the schema should work with cascade=True
9096
schema = PostgresSchema.delete_and_create(schema.name, cascade=True)
9197
assert _does_schema_exist(schema.name)
9298

93-
# Since the schema was deleteped and re-created, the `bla`
99+
# Since the schema was deleted and re-created, the `bla`
94100
# table should not exist anymore.
95101
with pytest.raises(ProgrammingError) as exc_info:
96102
with connection.cursor() as cursor:

0 commit comments

Comments
 (0)