| 1 |
import importlib |
| 2 |
from types import ModuleType |
| 3 |
|
| 4 |
import pytest |
| 5 |
|
| 6 |
from ...utils import needs_py310 |
| 7 |
|
| 8 |
|
| 9 |
@pytest.fixture( |
| 10 |
name="test_module", |
| 11 |
params=[ |
| 12 |
pytest.param("app_b_py310.test_main", marks=needs_py310), |
| 13 |
pytest.param("app_b_an_py310.test_main", marks=needs_py310), |
| 14 |
], |
| 15 |
) |
| 16 |
def get_test_module(request: pytest.FixtureRequest) -> ModuleType: |
| 17 |
mod: ModuleType = importlib.import_module(f"docs_src.app_testing.{request.param}") |
| 18 |
return mod |
| 19 |
|
| 20 |
|
| 21 |
def test_app(test_module: ModuleType): |
| 22 |
test_main = test_module |
| 23 |
test_main.test_create_existing_item() |
| 24 |
test_main.test_create_item() |
| 25 |
test_main.test_create_item_bad_token() |
| 26 |
test_main.test_read_nonexistent_item() |
| 27 |
test_main.test_read_item() |
| 28 |
test_main.test_read_item_bad_token() |