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-04-06 01:24 +0000

1import importlib 1abcd

2from types import ModuleType 1abcd

3 

4import pytest 1abcd

5 

6from ...utils import needs_py310 1abcd

7 

8 

9@pytest.fixture( 1abcd

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: 1abcd

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

18 return mod 1mnopqrst

19 

20 

21def test_app(test_module: ModuleType): 1abcd

22 test_main = test_module 1efghijkl

23 test_main.test_create_existing_item() 1efghijkl

24 test_main.test_create_item() 1efghijkl

25 test_main.test_create_item_bad_token() 1efghijkl

26 test_main.test_read_nonexistent_item() 1efghijkl

27 test_main.test_read_item() 1efghijkl

28 test_main.test_read_item_bad_token() 1efghijkl