airbyte-cdk 6.45.0.post20.dev14369762306__py3-none-any.whl → 6.45.0.post23.dev14384860031__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/declarative/models/scenario.py +7 -7
- airbyte_cdk/test/declarative/test_suites/connector_base.py +7 -2
- airbyte_cdk/test/declarative/test_suites/declarative_sources.py +1 -0
- airbyte_cdk/test/declarative/utils/job_runner.py +5 -5
- airbyte_cdk/test/pytest_config/plugin.py +14 -8
- {airbyte_cdk-6.45.0.post20.dev14369762306.dist-info → airbyte_cdk-6.45.0.post23.dev14384860031.dist-info}/METADATA +1 -1
- {airbyte_cdk-6.45.0.post20.dev14369762306.dist-info → airbyte_cdk-6.45.0.post23.dev14384860031.dist-info}/RECORD +11 -12
- airbyte_cdk/test/fixtures/general.py +0 -15
- {airbyte_cdk-6.45.0.post20.dev14369762306.dist-info → airbyte_cdk-6.45.0.post23.dev14384860031.dist-info}/LICENSE.txt +0 -0
- {airbyte_cdk-6.45.0.post20.dev14369762306.dist-info → airbyte_cdk-6.45.0.post23.dev14384860031.dist-info}/LICENSE_SHORT +0 -0
- {airbyte_cdk-6.45.0.post20.dev14369762306.dist-info → airbyte_cdk-6.45.0.post23.dev14384860031.dist-info}/WHEEL +0 -0
- {airbyte_cdk-6.45.0.post20.dev14369762306.dist-info → airbyte_cdk-6.45.0.post23.dev14384860031.dist-info}/entry_points.txt +0 -0
@@ -10,7 +10,7 @@ up iteration cycles.
|
|
10
10
|
from __future__ import annotations
|
11
11
|
|
12
12
|
from pathlib import Path
|
13
|
-
from typing import Literal
|
13
|
+
from typing import Any, Literal, cast
|
14
14
|
|
15
15
|
import yaml
|
16
16
|
from pydantic import BaseModel
|
@@ -33,7 +33,7 @@ class ConnectorTestScenario(BaseModel):
|
|
33
33
|
bypass_reason: str
|
34
34
|
|
35
35
|
config_path: Path | None = None
|
36
|
-
config_dict: dict | None = None
|
36
|
+
config_dict: dict[str, Any] | None = None
|
37
37
|
|
38
38
|
id: str | None = None
|
39
39
|
|
@@ -43,27 +43,27 @@ class ConnectorTestScenario(BaseModel):
|
|
43
43
|
file_types: AcceptanceTestFileTypes | None = None
|
44
44
|
status: Literal["succeed", "failed"] | None = None
|
45
45
|
|
46
|
-
def get_config_dict(self) -> dict:
|
46
|
+
def get_config_dict(self) -> dict[str, Any]:
|
47
47
|
"""Return the config dictionary.
|
48
48
|
|
49
49
|
If a config dictionary has already been loaded, return it. Otherwise, load
|
50
|
-
|
50
|
+
the config file and return the dictionary.
|
51
51
|
"""
|
52
52
|
if self.config_dict:
|
53
53
|
return self.config_dict
|
54
54
|
|
55
55
|
if self.config_path:
|
56
|
-
return yaml.safe_load(self.config_path.read_text())
|
56
|
+
return cast(dict[str, Any], yaml.safe_load(self.config_path.read_text()))
|
57
57
|
|
58
58
|
raise ValueError("No config dictionary or path provided.")
|
59
59
|
|
60
60
|
@property
|
61
61
|
def expect_exception(self) -> bool:
|
62
|
-
return self.status and self.status == "failed"
|
62
|
+
return self.status and self.status == "failed" or False
|
63
63
|
|
64
64
|
@property
|
65
65
|
def instance_name(self) -> str:
|
66
|
-
return self.config_path.stem
|
66
|
+
return self.config_path.stem if self.config_path else "Unnamed Scenario"
|
67
67
|
|
68
68
|
def __str__(self) -> str:
|
69
69
|
if self.id:
|
@@ -20,6 +20,11 @@ from airbyte_cdk.models import (
|
|
20
20
|
AirbyteMessage,
|
21
21
|
Type,
|
22
22
|
)
|
23
|
+
from airbyte_cdk.sources.declarative.declarative_source import (
|
24
|
+
AbstractSource,
|
25
|
+
ConcurrentDeclarativeSource,
|
26
|
+
Source,
|
27
|
+
)
|
23
28
|
from airbyte_cdk.test import entrypoint_wrapper
|
24
29
|
from airbyte_cdk.test.declarative.models import (
|
25
30
|
ConnectorTestScenario,
|
@@ -41,10 +46,10 @@ class RunnableConnector(abc.ABC):
|
|
41
46
|
"""A connector that can be run in a test scenario."""
|
42
47
|
|
43
48
|
@abc.abstractmethod
|
44
|
-
def launch(cls, args: list[str] | None): ...
|
49
|
+
def launch(cls, args: list[str] | None) -> None: ...
|
45
50
|
|
46
51
|
|
47
|
-
def generate_tests(metafunc):
|
52
|
+
def generate_tests(metafunc) -> None:
|
48
53
|
"""
|
49
54
|
A helper for pytest_generate_tests hook.
|
50
55
|
|
@@ -26,6 +26,7 @@ class DeclarativeSourceTestSuite(SourceTestSuiteBase):
|
|
26
26
|
def create_connector(
|
27
27
|
self, connector_test: ConnectorTestScenario
|
28
28
|
) -> ConcurrentDeclarativeSource:
|
29
|
+
"""Create a connector instance for the test suite."""
|
29
30
|
config = connector_test.get_config_dict()
|
30
31
|
# catalog = connector_test.get_catalog()
|
31
32
|
# state = connector_test.get_state()
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import tempfile
|
2
2
|
import uuid
|
3
3
|
from pathlib import Path
|
4
|
-
from typing import Callable, Literal
|
4
|
+
from typing import Any, Callable, Literal
|
5
5
|
|
6
6
|
import orjson
|
7
7
|
|
@@ -22,7 +22,7 @@ def run_test_job(
|
|
22
22
|
verb: Literal["read", "check", "discover"],
|
23
23
|
test_instance: ConnectorTestScenario,
|
24
24
|
*,
|
25
|
-
catalog: dict | None = None,
|
25
|
+
catalog: dict[str, Any] | None = None,
|
26
26
|
) -> entrypoint_wrapper.EntrypointOutput:
|
27
27
|
"""Run a test job from provided CLI args and return the result."""
|
28
28
|
if not connector:
|
@@ -49,7 +49,7 @@ def run_test_job(
|
|
49
49
|
else:
|
50
50
|
raise ValueError(f"Invalid source type: {type(connector)}")
|
51
51
|
|
52
|
-
args = [verb]
|
52
|
+
args: list[str] = [verb]
|
53
53
|
if test_instance.config_path:
|
54
54
|
args += ["--config", str(test_instance.config_path)]
|
55
55
|
elif test_instance.config_dict:
|
@@ -103,12 +103,12 @@ def run_test_job(
|
|
103
103
|
assert len(result.connection_status_messages) == 1, (
|
104
104
|
"Expected exactly one CONNECTION_STATUS message. Got "
|
105
105
|
f"{len(result.connection_status_messages)}:\n"
|
106
|
-
+ "\n".join(result.connection_status_messages)
|
106
|
+
+ "\n".join([str(msg) for msg in result.connection_status_messages])
|
107
107
|
)
|
108
108
|
if test_instance.expect_exception:
|
109
109
|
assert result.connection_status_messages[0].connectionStatus.status == Status.FAILED, (
|
110
110
|
"Expected CONNECTION_STATUS message to be FAILED. Got: \n"
|
111
|
-
+ "\n".join([str(result.connection_status_messages
|
111
|
+
+ "\n".join([str(msg) for msg in result.connection_status_messages])
|
112
112
|
)
|
113
113
|
return result
|
114
114
|
|
@@ -1,18 +1,24 @@
|
|
1
|
+
"""Global pytest configuration for the Airbyte CDK tests."""
|
2
|
+
|
1
3
|
from pathlib import Path
|
4
|
+
from typing import Optional
|
2
5
|
|
3
6
|
import pytest
|
4
7
|
|
5
8
|
|
6
|
-
def pytest_collect_file(parent, path):
|
7
|
-
|
8
|
-
|
9
|
+
def pytest_collect_file(parent: Optional[pytest.Module], path: Path) -> pytest.Module | None:
|
10
|
+
"""Collect test files based on their names."""
|
11
|
+
if path.name == "test_connector.py":
|
12
|
+
return cast(pytest.Module, pytest.Module.from_parent(parent, path=path))
|
13
|
+
|
14
|
+
return None
|
9
15
|
|
10
16
|
|
11
|
-
def pytest_configure(config):
|
17
|
+
def pytest_configure(config: pytest.Config) -> None:
|
12
18
|
config.addinivalue_line("markers", "connector: mark test as a connector test")
|
13
19
|
|
14
20
|
|
15
|
-
def pytest_addoption(parser):
|
21
|
+
def pytest_addoption(parser: pytest.Parser) -> None:
|
16
22
|
parser.addoption(
|
17
23
|
"--run-connector",
|
18
24
|
action="store_true",
|
@@ -21,7 +27,7 @@ def pytest_addoption(parser):
|
|
21
27
|
)
|
22
28
|
|
23
29
|
|
24
|
-
def pytest_collection_modifyitems(config, items):
|
30
|
+
def pytest_collection_modifyitems(config: pytest.Config, items: list[pytest.Item]) -> None:
|
25
31
|
if config.getoption("--run-connector"):
|
26
32
|
return
|
27
33
|
skip_connector = pytest.mark.skip(reason="need --run-connector option to run")
|
@@ -30,11 +36,11 @@ def pytest_collection_modifyitems(config, items):
|
|
30
36
|
item.add_marker(skip_connector)
|
31
37
|
|
32
38
|
|
33
|
-
def pytest_runtest_setup(item):
|
39
|
+
def pytest_runtest_setup(item: pytest.Item) -> None:
|
34
40
|
# This hook is called before each test function is executed
|
35
41
|
print(f"Setting up test: {item.name}")
|
36
42
|
|
37
43
|
|
38
|
-
def pytest_runtest_teardown(item, nextitem):
|
44
|
+
def pytest_runtest_teardown(item: pytest.Item, nextitem: Optional[pytest.Item]) -> None:
|
39
45
|
# This hook is called after each test function is executed
|
40
46
|
print(f"Tearing down test: {item.name}")
|
@@ -338,25 +338,24 @@ airbyte_cdk/test/__init__.py,sha256=f_XdkOg4_63QT2k3BbKY34209lppwgw-svzfZstQEq4,
|
|
338
338
|
airbyte_cdk/test/catalog_builder.py,sha256=-y05Cz1x0Dlk6oE9LSKhCozssV2gYBNtMdV5YYOPOtk,3015
|
339
339
|
airbyte_cdk/test/declarative/__init__.py,sha256=IpPLFCCWnlpp_eTGKK_2WGRFfenbnolxYLmkQSZMO3U,205
|
340
340
|
airbyte_cdk/test/declarative/models/__init__.py,sha256=rXoywbDd-oqEhRQLuaEQIDxykMeawHjzzeN3XIpGQN8,132
|
341
|
-
airbyte_cdk/test/declarative/models/scenario.py,sha256=
|
341
|
+
airbyte_cdk/test/declarative/models/scenario.py,sha256=ySzQosxi2TRaw7JbQMFsuBieoH0ufXJhEY8Vu3DXtx4,2378
|
342
342
|
airbyte_cdk/test/declarative/test_suites/__init__.py,sha256=E1KY-xxKjkKXYaAVyCs96-ZMCCoDhR24s2eQhWWOx-c,769
|
343
|
-
airbyte_cdk/test/declarative/test_suites/connector_base.py,sha256=
|
344
|
-
airbyte_cdk/test/declarative/test_suites/declarative_sources.py,sha256=
|
343
|
+
airbyte_cdk/test/declarative/test_suites/connector_base.py,sha256=7qFjRI6NkJPOTIHndl8KvWz4eM2PiXMPBSKOBpGKk7o,6760
|
344
|
+
airbyte_cdk/test/declarative/test_suites/declarative_sources.py,sha256=4VPGzG8keyci0x2o6_jNqx7HcAuamumJoPafudH5w_o,1633
|
345
345
|
airbyte_cdk/test/declarative/test_suites/destination_base.py,sha256=L_l1gpNCkzfx-c7mzS1He5hTVbqR39OnfWdrYMglS7E,486
|
346
346
|
airbyte_cdk/test/declarative/test_suites/source_base.py,sha256=1VJ9KXM1nSodFKh2VKXc2cO010JfE-df2JoVGKasrmk,4381
|
347
347
|
airbyte_cdk/test/declarative/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
348
|
-
airbyte_cdk/test/declarative/utils/job_runner.py,sha256=
|
348
|
+
airbyte_cdk/test/declarative/utils/job_runner.py,sha256=AI10Nt5MEMbJt_zNNBatUPStvMEF1mstHzow-11ZVsE,4845
|
349
349
|
airbyte_cdk/test/entrypoint_wrapper.py,sha256=TyUmVJyIuGelAv6y8Wy_BnwqIRw_drjfZWKlroljCuQ,9951
|
350
350
|
airbyte_cdk/test/fixtures/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
351
351
|
airbyte_cdk/test/fixtures/auto.py,sha256=wYKu1pBUJX60Bg-K2RwNXi11Txu1Rncc8WNlOvy9Zug,354
|
352
|
-
airbyte_cdk/test/fixtures/general.py,sha256=pvAqTR1F5CZX4sIn8J7ON5T5Vy5f7SqK6XkHpMbt8c8,255
|
353
352
|
airbyte_cdk/test/mock_http/__init__.py,sha256=jE5kC6CQ0OXkTqKhciDnNVZHesBFVIA2YvkdFGwva7k,322
|
354
353
|
airbyte_cdk/test/mock_http/matcher.py,sha256=4Qj8UnJKZIs-eodshryce3SN1Ayc8GZpBETmP6hTEyc,1446
|
355
354
|
airbyte_cdk/test/mock_http/mocker.py,sha256=XgsjMtVoeMpRELPyALgrkHFauH9H5irxrz1Kcxh2yFY,8013
|
356
355
|
airbyte_cdk/test/mock_http/request.py,sha256=tdB8cqk2vLgCDTOKffBKsM06llYs4ZecgtH6DKyx6yY,4112
|
357
356
|
airbyte_cdk/test/mock_http/response.py,sha256=s4-cQQqTtmeej0pQDWqmG0vUWpHS-93lIWMpW3zSVyU,662
|
358
357
|
airbyte_cdk/test/mock_http/response_builder.py,sha256=debPx_lRYBaQVSwCoKLa0F8KFk3h0qG7bWxFBATa0cc,7958
|
359
|
-
airbyte_cdk/test/pytest_config/plugin.py,sha256=
|
358
|
+
airbyte_cdk/test/pytest_config/plugin.py,sha256=Z2RYpXOKTRsytb0pn0K-PvkQlQXeOppnEcX4IlBEZfI,1457
|
360
359
|
airbyte_cdk/test/state_builder.py,sha256=kLPql9lNzUJaBg5YYRLJlY_Hy5JLHJDVyKPMZMoYM44,946
|
361
360
|
airbyte_cdk/test/utils/__init__.py,sha256=Hu-1XT2KDoYjDF7-_ziDwv5bY3PueGjANOCbzeOegDg,57
|
362
361
|
airbyte_cdk/test/utils/data.py,sha256=CkCR1_-rujWNmPXFR1IXTMwx1rAl06wAyIKWpDcN02w,820
|
@@ -380,9 +379,9 @@ airbyte_cdk/utils/slice_hasher.py,sha256=EDxgROHDbfG-QKQb59m7h_7crN1tRiawdf5uU7G
|
|
380
379
|
airbyte_cdk/utils/spec_schema_transformations.py,sha256=-5HTuNsnDBAhj-oLeQXwpTGA0HdcjFOf2zTEMUTTg_Y,816
|
381
380
|
airbyte_cdk/utils/stream_status_utils.py,sha256=ZmBoiy5HVbUEHAMrUONxZvxnvfV9CesmQJLDTAIWnWw,1171
|
382
381
|
airbyte_cdk/utils/traced_exception.py,sha256=C8uIBuCL_E4WnBAOPSxBicD06JAldoN9fGsQDp463OY,6292
|
383
|
-
airbyte_cdk-6.45.0.
|
384
|
-
airbyte_cdk-6.45.0.
|
385
|
-
airbyte_cdk-6.45.0.
|
386
|
-
airbyte_cdk-6.45.0.
|
387
|
-
airbyte_cdk-6.45.0.
|
388
|
-
airbyte_cdk-6.45.0.
|
382
|
+
airbyte_cdk-6.45.0.post23.dev14384860031.dist-info/LICENSE.txt,sha256=Wfe61S4BaGPj404v8lrAbvhjYR68SHlkzeYrg3_bbuM,1051
|
383
|
+
airbyte_cdk-6.45.0.post23.dev14384860031.dist-info/LICENSE_SHORT,sha256=aqF6D1NcESmpn-cqsxBtszTEnHKnlsp8L4x9wAh3Nxg,55
|
384
|
+
airbyte_cdk-6.45.0.post23.dev14384860031.dist-info/METADATA,sha256=9vnnu8hLTvth6IXJb8KCu045Tl6ulUD0afpW1H0qziU,6093
|
385
|
+
airbyte_cdk-6.45.0.post23.dev14384860031.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
386
|
+
airbyte_cdk-6.45.0.post23.dev14384860031.dist-info/entry_points.txt,sha256=fj-e3PAQvsxsQzyyq8UkG1k8spunWnD4BAH2AwlR6NM,95
|
387
|
+
airbyte_cdk-6.45.0.post23.dev14384860031.dist-info/RECORD,,
|
@@ -1,15 +0,0 @@
|
|
1
|
-
"""General fixtures for pytest.
|
2
|
-
|
3
|
-
Usage:
|
4
|
-
|
5
|
-
```python
|
6
|
-
from airbyte_cdk.test.fixtures.general import *
|
7
|
-
# OR:
|
8
|
-
from airbyte_cdk.test.fixtures.general import connector_test_dir
|
9
|
-
```
|
10
|
-
"""
|
11
|
-
|
12
|
-
|
13
|
-
@pytest.fixture
|
14
|
-
def connector_test_dir():
|
15
|
-
return Path(__file__).parent
|
File without changes
|
File without changes
|
File without changes
|