thomas commited on
Commit ·
7f20e53
1
Parent(s): 25fe19a
feature(#13): update pytest.
Browse files- tests/conftest.py +6 -5
tests/conftest.py
CHANGED
|
@@ -1,13 +1,14 @@
|
|
| 1 |
import pytest
|
| 2 |
-
from
|
|
|
|
| 3 |
|
| 4 |
|
| 5 |
@pytest.fixture(scope="module")
|
| 6 |
def test_client():
|
| 7 |
-
|
| 8 |
-
|
| 9 |
# Create a test client using the Flask application configured for testing
|
| 10 |
-
with
|
| 11 |
# Establish an application context
|
| 12 |
-
with
|
| 13 |
yield testing_client # this is where the testing happens!
|
|
|
|
| 1 |
import pytest
|
| 2 |
+
from fastapi import FastAPI
|
| 3 |
+
from fastapi.testclient import TestClient
|
| 4 |
|
| 5 |
|
| 6 |
@pytest.fixture(scope="module")
|
| 7 |
def test_client():
|
| 8 |
+
app = FastAPI()
|
| 9 |
+
client = TestClient(app)
|
| 10 |
# Create a test client using the Flask application configured for testing
|
| 11 |
+
with client as testing_client:
|
| 12 |
# Establish an application context
|
| 13 |
+
with client.app:
|
| 14 |
yield testing_client # this is where the testing happens!
|