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

16 statements  

« prev     ^ index     » next       coverage.py v7.6.1, created at 2025-05-05 00:03 +0000

1import importlib 1abcdef

2from types import ModuleType 1abcdef

3 

4import pytest 1abcdef

5 

6from ...utils import needs_py39, needs_py310 1abcdef

7 

8 

9@pytest.fixture( 1abcdef

10 name="test_module", 

11 params=[ 

12 "app_b.test_main", 

13 pytest.param("app_b_py310.test_main", marks=needs_py310), 

14 "app_b_an.test_main", 

15 pytest.param("app_b_an_py39.test_main", marks=needs_py39), 

16 pytest.param("app_b_an_py310.test_main", marks=needs_py310), 

17 ], 

18) 

19def get_test_module(request: pytest.FixtureRequest) -> ModuleType: 1abcdef

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

21 return mod 1abcdef

22 

23 

24def test_app(test_module: ModuleType): 1abcdef

25 test_main = test_module 1ghijkl

26 test_main.test_create_existing_item() 1ghijkl

27 test_main.test_create_item() 1ghijkl

28 test_main.test_create_item_bad_token() 1ghijkl

29 test_main.test_read_nonexistent_item() 1ghijkl

30 test_main.test_read_item() 1ghijkl

31 test_main.test_read_item_bad_token() 1ghijkl