Coverage for /usr/local/lib/python3.12/site-packages/prefect/settings/models/testing.py: 100%

10 statements  

« prev     ^ index     » next       coverage.py v7.10.6, created at 2025-12-05 11:21 +0000

1from typing import Any, ClassVar, Optional 1a

2 

3from pydantic import AliasChoices, AliasPath, Field 1a

4from pydantic_settings import SettingsConfigDict 1a

5 

6from prefect.settings.base import PrefectBaseSettings, build_settings_config 1a

7 

8 

9class TestingSettings(PrefectBaseSettings): 1a

10 model_config: ClassVar[SettingsConfigDict] = build_settings_config(("testing",)) 1a

11 

12 test_mode: bool = Field( 1a

13 default=False, 

14 description="If `True`, places the API in test mode. This may modify behavior to facilitate testing.", 

15 validation_alias=AliasChoices( 

16 AliasPath("test_mode"), 

17 "prefect_testing_test_mode", 

18 "prefect_test_mode", 

19 ), 

20 ) 

21 

22 unit_test_mode: bool = Field( 1a

23 default=False, 

24 description="This setting only exists to facilitate unit testing. If `True`, code is executing in a unit test context. Defaults to `False`.", 

25 validation_alias=AliasChoices( 

26 AliasPath("unit_test_mode"), 

27 "prefect_testing_unit_test_mode", 

28 "prefect_unit_test_mode", 

29 ), 

30 ) 

31 

32 unit_test_loop_debug: bool = Field( 1a

33 default=True, 

34 description="If `True` turns on debug mode for the unit testing event loop.", 

35 validation_alias=AliasChoices( 

36 AliasPath("unit_test_loop_debug"), 

37 "prefect_testing_unit_test_loop_debug", 

38 "prefect_unit_test_loop_debug", 

39 ), 

40 ) 

41 

42 test_setting: Optional[Any] = Field( 1a

43 default="FOO", 

44 description="This setting only exists to facilitate unit testing. If in test mode, this setting will return its value. Otherwise, it returns `None`.", 

45 validation_alias=AliasChoices( 

46 AliasPath("test_setting"), 

47 "prefect_testing_test_setting", 

48 "prefect_test_setting", 

49 ), 

50 )