Coverage for tests / test_tutorial / test_testing / test_main_b.py: 100%

16 statements  

« prev     ^ index     » next       coverage.py v7.13.3, created at 2026-02-12 18:15 +0000

1import importlib 1abdc

2from types import ModuleType 1abdc

3 

4import pytest 1abdc

5 

6from ...utils import needs_py310 1abdc

7 

8 

9@pytest.fixture( 1abdc

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) 

16def get_test_module(request: pytest.FixtureRequest) -> ModuleType: 1abdc

17 mod: ModuleType = importlib.import_module(f"docs_src.app_testing.{request.param}") 1abc

18 return mod 1abc

19 

20 

21def test_app(test_module: ModuleType): 1abdc

22 test_main = test_module 1efg

23 test_main.test_create_existing_item() 1efg

24 test_main.test_create_item() 1efg

25 test_main.test_create_item_bad_token() 1efg

26 test_main.test_read_nonexistent_item() 1efg

27 test_main.test_read_item() 1efg

28 test_main.test_read_item_bad_token() 1efg