Use in memory databases for testing
This commit is contained in:
parent
34f37667ef
commit
0921b7205e
@ -19,6 +19,10 @@ import app.database as database
|
|||||||
def client() -> TestClient:
|
def client() -> TestClient:
|
||||||
return TestClient(app)
|
return TestClient(app)
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def db_connection():
|
def db_connection():
|
||||||
return database.connect("test.sqlite3")
|
connection = database.connect(":memory:")
|
||||||
|
database.apply_database_schema(connection)
|
||||||
|
yield connection
|
||||||
|
connection.close()
|
||||||
|
@ -5,8 +5,6 @@ from app.types import Order, OrderSide, OrderType
|
|||||||
|
|
||||||
|
|
||||||
def test_store_order(db_connection):
|
def test_store_order(db_connection):
|
||||||
database.apply_database_schema(db_connection)
|
|
||||||
|
|
||||||
order = Order(
|
order = Order(
|
||||||
id="",
|
id="",
|
||||||
created_at=datetime.now(),
|
created_at=datetime.now(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user