44
55
66from dataclasses import asdict , dataclass , field
7- from typing import Any , Dict , List , Mapping , Optional
7+ from typing import Any , ClassVar , Dict , List , Mapping , Optional
88
99from airbyte_cdk .connector_builder .test_reader import TestReader
1010from airbyte_cdk .models import (
3737
3838@dataclass
3939class TestLimits :
40+ __test__ : ClassVar [bool ] = False # Tell Pytest this is not a Pytest class, despite its name
41+
4042 max_records : int = field (default = DEFAULT_MAXIMUM_RECORDS )
4143 max_pages_per_slice : int = field (default = DEFAULT_MAXIMUM_NUMBER_OF_PAGES_PER_SLICE )
4244 max_slices : int = field (default = DEFAULT_MAXIMUM_NUMBER_OF_SLICES )
@@ -53,18 +55,33 @@ def get_limits(config: Mapping[str, Any]) -> TestLimits:
5355 max_streams = command_config .get (MAX_STREAMS_KEY ) or DEFAULT_MAXIMUM_STREAMS
5456 return TestLimits (max_records , max_pages_per_slice , max_slices , max_streams )
5557
58+ def normalize_manifest (config : Mapping [str , Any ]) -> bool :
59+ """
60+ Check if the manifest should be normalized.
61+ :param config: The configuration to check
62+ :return: True if the manifest should be normalized, False otherwise.
63+ """
64+ return config .get ("__requires_normalization" , False )
65+
66+ def post_resolve_manifest (config : Mapping [str , Any ]) -> bool :
67+ """
68+ Check if the manifest should be post-resolved.
69+ :param config: The configuration to check
70+ :return: True if the manifest should be post-resolved, False otherwise.
71+ """
72+ return config .get ("__post_resolve_manifest" , False )
5673
5774def create_source (
5875 config : Mapping [str , Any ],
5976 limits : TestLimits ,
60- post_resolve_manifest : Optional [bool ] = False ,
6177) -> ManifestDeclarativeSource :
6278 manifest = config ["__injected_declarative_manifest" ]
6379 return ManifestDeclarativeSource (
6480 config = config ,
6581 emit_connector_builder_messages = True ,
6682 source_config = manifest ,
67- post_resolve_manifest = post_resolve_manifest ,
83+ normalize_manifest = normalize_manifest (config ),
84+ post_resolve_manifest = post_resolve_manifest (config ),
6885 component_factory = ModelToComponentFactory (
6986 emit_connector_builder_messages = True ,
7087 limit_pages_fetched_per_slice = limits .max_pages_per_slice ,
0 commit comments