feature/db #2
@@ -24,7 +24,6 @@ def engine() -> Generator[Engine, None, None]:
|
|||||||
yield e
|
yield e
|
||||||
finally:
|
finally:
|
||||||
SQLModel.metadata.drop_all(e)
|
SQLModel.metadata.drop_all(e)
|
||||||
SQLModel.metadata.clear()
|
|
||||||
e.dispose()
|
e.dispose()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,6 @@ def database_ctx(db: Database) -> Generator[Database, None, None]:
|
|||||||
yield db
|
yield db
|
||||||
finally:
|
finally:
|
||||||
db.dispose()
|
db.dispose()
|
||||||
SQLModel.metadata.clear()
|
|
||||||
|
|
||||||
|
|
||||||
def test_select_one_executes() -> None:
|
def test_select_one_executes() -> None:
|
||||||
@@ -77,6 +76,7 @@ def test_sqlite_pragmas_applied() -> None:
|
|||||||
|
|
||||||
def test_rollback_on_exception() -> None:
|
def test_rollback_on_exception() -> None:
|
||||||
db = create_database(None)
|
db = create_database(None)
|
||||||
|
SQLModel.metadata.clear()
|
||||||
db.init_db()
|
db.init_db()
|
||||||
with database_ctx(db):
|
with database_ctx(db):
|
||||||
# Create table then insert and raise inside the same session to force rollback
|
# Create table then insert and raise inside the same session to force rollback
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ def _base_type_of(compiled: str) -> str:
|
|||||||
|
|
||||||
def test_run_migrations_0_to_1(monkeypatch: pytest.MonkeyPatch) -> None:
|
def test_run_migrations_0_to_1(monkeypatch: pytest.MonkeyPatch) -> None:
|
||||||
# in-memory engine that preserves the same connection (StaticPool)
|
# in-memory engine that preserves the same connection (StaticPool)
|
||||||
|
SQLModel.metadata.clear()
|
||||||
engine = create_engine(
|
engine = create_engine(
|
||||||
"sqlite:///:memory:",
|
"sqlite:///:memory:",
|
||||||
connect_args={"check_same_thread": False},
|
connect_args={"check_same_thread": False},
|
||||||
|
|||||||
Reference in New Issue
Block a user