airbyte-cdk 6.9.2__py3-none-any.whl → 6.9.3rc1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- airbyte_cdk/test/utils/manifest_only_fixtures.py +60 -0
- {airbyte_cdk-6.9.2.dist-info → airbyte_cdk-6.9.3rc1.dist-info}/METADATA +1 -1
- {airbyte_cdk-6.9.2.dist-info → airbyte_cdk-6.9.3rc1.dist-info}/RECORD +6 -5
- {airbyte_cdk-6.9.2.dist-info → airbyte_cdk-6.9.3rc1.dist-info}/LICENSE.txt +0 -0
- {airbyte_cdk-6.9.2.dist-info → airbyte_cdk-6.9.3rc1.dist-info}/WHEEL +0 -0
- {airbyte_cdk-6.9.2.dist-info → airbyte_cdk-6.9.3rc1.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,60 @@
|
|
1
|
+
# Copyright (c) 2024 Airbyte, Inc., all rights reserved.
|
2
|
+
|
3
|
+
|
4
|
+
import importlib.util
|
5
|
+
from pathlib import Path
|
6
|
+
from types import ModuleType
|
7
|
+
from typing import Optional
|
8
|
+
|
9
|
+
import pytest
|
10
|
+
|
11
|
+
# The following fixtures are used to load a manifest-only connector's components module and manifest file.
|
12
|
+
# They can be accessed from any test file in the connector's unit_tests directory by importing them as follows:
|
13
|
+
|
14
|
+
# from airbyte_cdk.test.utils.manifest_only_fixtures import components_module, connector_dir, manifest_path
|
15
|
+
|
16
|
+
# individual components can then be referenced as: components_module.<CustomComponentClass>
|
17
|
+
|
18
|
+
|
19
|
+
@pytest.fixture(scope="session")
|
20
|
+
def connector_dir(request: pytest.FixtureRequest) -> Path:
|
21
|
+
"""Return the connector's root directory."""
|
22
|
+
|
23
|
+
current_dir = Path(request.config.invocation_params.dir)
|
24
|
+
|
25
|
+
# If the tests are run locally from the connector's unit_tests directory, return the parent (connector) directory
|
26
|
+
if current_dir.name == "unit_tests":
|
27
|
+
return current_dir.parent
|
28
|
+
# In CI, the tests are run from the connector directory itself
|
29
|
+
return current_dir
|
30
|
+
|
31
|
+
|
32
|
+
@pytest.fixture(scope="session")
|
33
|
+
def components_module(connector_dir: Path) -> Optional[ModuleType]:
|
34
|
+
"""Load and return the components module from the connector directory.
|
35
|
+
|
36
|
+
This assumes the components module is located at <connector_dir>/components.py.
|
37
|
+
"""
|
38
|
+
components_path = connector_dir / "components.py"
|
39
|
+
if not components_path.exists():
|
40
|
+
return None
|
41
|
+
|
42
|
+
components_spec = importlib.util.spec_from_file_location("components", components_path)
|
43
|
+
if components_spec is None:
|
44
|
+
return None
|
45
|
+
|
46
|
+
components_module = importlib.util.module_from_spec(components_spec)
|
47
|
+
if components_spec.loader is None:
|
48
|
+
return None
|
49
|
+
|
50
|
+
components_spec.loader.exec_module(components_module)
|
51
|
+
return components_module
|
52
|
+
|
53
|
+
|
54
|
+
@pytest.fixture(scope="session")
|
55
|
+
def manifest_path(connector_dir: Path) -> Path:
|
56
|
+
"""Return the path to the connector's manifest file."""
|
57
|
+
path = connector_dir / "manifest.yaml"
|
58
|
+
if not path.exists():
|
59
|
+
raise FileNotFoundError(f"Manifest file not found at {path}")
|
60
|
+
return path
|
@@ -316,6 +316,7 @@ airbyte_cdk/test/state_builder.py,sha256=kLPql9lNzUJaBg5YYRLJlY_Hy5JLHJDVyKPMZMo
|
|
316
316
|
airbyte_cdk/test/utils/__init__.py,sha256=Hu-1XT2KDoYjDF7-_ziDwv5bY3PueGjANOCbzeOegDg,57
|
317
317
|
airbyte_cdk/test/utils/data.py,sha256=CkCR1_-rujWNmPXFR1IXTMwx1rAl06wAyIKWpDcN02w,820
|
318
318
|
airbyte_cdk/test/utils/http_mocking.py,sha256=F2hpm2q4ijojQN5u2XtgTAp8aNgHgJ64eZNkZ9BW0ig,550
|
319
|
+
airbyte_cdk/test/utils/manifest_only_fixtures.py,sha256=zpOL9UkuXprXHF-wAiBeH6CLpoLEaF3Vh6_9rcItj3Y,2135
|
319
320
|
airbyte_cdk/test/utils/reading.py,sha256=SOTDYlps6Te9KumfTJ3vVDSm9EUXhvKtE8aD7gvdPlg,965
|
320
321
|
airbyte_cdk/utils/__init__.py,sha256=gHjOCoUkolS_nKtgFSudXUY-ObK2vUo6aNQLvW7o8q8,347
|
321
322
|
airbyte_cdk/utils/airbyte_secrets_utils.py,sha256=wEtRnl5KRhN6eLJwrDrC4FJjyqt_4vkA1F65mdl8c24,3142
|
@@ -333,8 +334,8 @@ airbyte_cdk/utils/slice_hasher.py,sha256=-pHexlNYoWYPnXNH-M7HEbjmeJe9Zk7SJijdQ7d
|
|
333
334
|
airbyte_cdk/utils/spec_schema_transformations.py,sha256=-5HTuNsnDBAhj-oLeQXwpTGA0HdcjFOf2zTEMUTTg_Y,816
|
334
335
|
airbyte_cdk/utils/stream_status_utils.py,sha256=ZmBoiy5HVbUEHAMrUONxZvxnvfV9CesmQJLDTAIWnWw,1171
|
335
336
|
airbyte_cdk/utils/traced_exception.py,sha256=C8uIBuCL_E4WnBAOPSxBicD06JAldoN9fGsQDp463OY,6292
|
336
|
-
airbyte_cdk-6.9.
|
337
|
-
airbyte_cdk-6.9.
|
338
|
-
airbyte_cdk-6.9.
|
339
|
-
airbyte_cdk-6.9.
|
340
|
-
airbyte_cdk-6.9.
|
337
|
+
airbyte_cdk-6.9.3rc1.dist-info/LICENSE.txt,sha256=Wfe61S4BaGPj404v8lrAbvhjYR68SHlkzeYrg3_bbuM,1051
|
338
|
+
airbyte_cdk-6.9.3rc1.dist-info/METADATA,sha256=t_8bgC-oSwCBbpuCrYoLrS-mw15JcqfJAw0Ajv9GXhY,5952
|
339
|
+
airbyte_cdk-6.9.3rc1.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
340
|
+
airbyte_cdk-6.9.3rc1.dist-info/entry_points.txt,sha256=fj-e3PAQvsxsQzyyq8UkG1k8spunWnD4BAH2AwlR6NM,95
|
341
|
+
airbyte_cdk-6.9.3rc1.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|