File size: 440 Bytes
bf41ce7
7f20e53
 
bf41ce7
 
 
 
7f20e53
 
52bf0ec
7f20e53
bf41ce7
7f20e53
bf41ce7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import pytest
from fastapi import FastAPI
from fastapi.testclient import TestClient


@pytest.fixture(scope="module")
def test_client():
    app = FastAPI()
    client = TestClient(app)
    # Create a test client using the FastApi application configured for testing
    with client as testing_client:
        # Establish an application context
        with client.app:
            yield testing_client  # this is where the testing happens!