airbyte-cdk 6.45.1.post44.dev14417290834__py3-none-any.whl → 6.45.1.post46.dev14423672753__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.
@@ -6,8 +6,9 @@ from __future__ import annotations
6
6
  import abc
7
7
  import inspect
8
8
  import sys
9
+ from collections.abc import Callable
9
10
  from pathlib import Path
10
- from typing import Any, Literal
11
+ from typing import Any, Literal, cast
11
12
 
12
13
  import pytest
13
14
  import yaml
@@ -90,6 +91,9 @@ def generate_tests(metafunc: pytest.Metafunc) -> None:
90
91
  class ConnectorTestSuiteBase(abc.ABC):
91
92
  """Base class for connector test suites."""
92
93
 
94
+ connector: type[IConnector] | Callable[[], IConnector] | None = None
95
+ """The connector class or a factory function that returns an instance of IConnector."""
96
+
93
97
  @classmethod
94
98
  def get_test_class_dir(cls) -> Path:
95
99
  """Get the file path that contains the class."""
@@ -97,16 +101,24 @@ class ConnectorTestSuiteBase(abc.ABC):
97
101
  # Get the directory containing the test file
98
102
  return Path(inspect.getfile(module)).parent
99
103
 
100
- connector: type[Connector] | Path | JavaClass | DockerImage | None = None
101
- """The connector class or path to the connector to test."""
102
-
103
104
  @classmethod
104
105
  def create_connector(
105
106
  cls,
106
107
  scenario: ConnectorTestScenario,
107
108
  ) -> IConnector:
108
109
  """Instantiate the connector class."""
109
- raise NotImplementedError("Subclasses must implement this method.")
110
+ connector = cls.connector # type: ignore
111
+ if connector:
112
+ if callable(connector) or isinstance(connector, type):
113
+ # If the connector is a class or factory function, instantiate it:
114
+ return cast(IConnector, connector()) # type: ignore [redundant-cast]
115
+
116
+ # Otherwise, we can't instantiate the connector. Fail with a clear error message.
117
+ raise NotImplementedError(
118
+ "No connector class or connector factory function provided. "
119
+ "Please provide a class or factory function in `cls.connector`, or "
120
+ "override `cls.create_connector()` to define a custom initialization process."
121
+ )
110
122
 
111
123
  def run_test_scenario(
112
124
  self,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: airbyte-cdk
3
- Version: 6.45.1.post44.dev14417290834
3
+ Version: 6.45.1.post46.dev14423672753
4
4
  Summary: A framework for writing Airbyte Connectors.
5
5
  Home-page: https://airbyte.com
6
6
  License: MIT
@@ -340,7 +340,7 @@ airbyte_cdk/test/declarative/__init__.py,sha256=IpPLFCCWnlpp_eTGKK_2WGRFfenbnolx
340
340
  airbyte_cdk/test/declarative/models/__init__.py,sha256=rXoywbDd-oqEhRQLuaEQIDxykMeawHjzzeN3XIpGQN8,132
341
341
  airbyte_cdk/test/declarative/models/scenario.py,sha256=ySzQosxi2TRaw7JbQMFsuBieoH0ufXJhEY8Vu3DXtx4,2378
342
342
  airbyte_cdk/test/declarative/test_suites/__init__.py,sha256=ELgLwaAQ6Gl0RWW5qZleOGeiNvx4o9ldR7JUbwJ9i28,797
343
- airbyte_cdk/test/declarative/test_suites/connector_base.py,sha256=NyXjroCMOp7VrEMqQxH9SzW6Ti2Om3B2ErRRXKDOTLA,7212
343
+ airbyte_cdk/test/declarative/test_suites/connector_base.py,sha256=oTQLy9TRP2GRhRlbnw2-4E6O5o4R_QgIJG_V57QpKZY,7892
344
344
  airbyte_cdk/test/declarative/test_suites/declarative_sources.py,sha256=CZW5EDBUZkT10bdTSalFwo-P9ARv8z5V6YsrJdhUzjk,2485
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=SY6yaJ0qghdlwcw5-U04Ni0Hh2-HuqRsDz24cz6iinQ,4575
@@ -379,9 +379,9 @@ airbyte_cdk/utils/slice_hasher.py,sha256=EDxgROHDbfG-QKQb59m7h_7crN1tRiawdf5uU7G
379
379
  airbyte_cdk/utils/spec_schema_transformations.py,sha256=-5HTuNsnDBAhj-oLeQXwpTGA0HdcjFOf2zTEMUTTg_Y,816
380
380
  airbyte_cdk/utils/stream_status_utils.py,sha256=ZmBoiy5HVbUEHAMrUONxZvxnvfV9CesmQJLDTAIWnWw,1171
381
381
  airbyte_cdk/utils/traced_exception.py,sha256=C8uIBuCL_E4WnBAOPSxBicD06JAldoN9fGsQDp463OY,6292
382
- airbyte_cdk-6.45.1.post44.dev14417290834.dist-info/LICENSE.txt,sha256=Wfe61S4BaGPj404v8lrAbvhjYR68SHlkzeYrg3_bbuM,1051
383
- airbyte_cdk-6.45.1.post44.dev14417290834.dist-info/LICENSE_SHORT,sha256=aqF6D1NcESmpn-cqsxBtszTEnHKnlsp8L4x9wAh3Nxg,55
384
- airbyte_cdk-6.45.1.post44.dev14417290834.dist-info/METADATA,sha256=jw0gJWzbE5gnVhH7xr3fpWIRqIGYWfUJ0JMwvNAmdxo,6135
385
- airbyte_cdk-6.45.1.post44.dev14417290834.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
386
- airbyte_cdk-6.45.1.post44.dev14417290834.dist-info/entry_points.txt,sha256=fj-e3PAQvsxsQzyyq8UkG1k8spunWnD4BAH2AwlR6NM,95
387
- airbyte_cdk-6.45.1.post44.dev14417290834.dist-info/RECORD,,
382
+ airbyte_cdk-6.45.1.post46.dev14423672753.dist-info/LICENSE.txt,sha256=Wfe61S4BaGPj404v8lrAbvhjYR68SHlkzeYrg3_bbuM,1051
383
+ airbyte_cdk-6.45.1.post46.dev14423672753.dist-info/LICENSE_SHORT,sha256=aqF6D1NcESmpn-cqsxBtszTEnHKnlsp8L4x9wAh3Nxg,55
384
+ airbyte_cdk-6.45.1.post46.dev14423672753.dist-info/METADATA,sha256=3Kw3TrCB_fLtf4uYs6rAGU66z0jAHIg5YBx7u-6YwZg,6135
385
+ airbyte_cdk-6.45.1.post46.dev14423672753.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
386
+ airbyte_cdk-6.45.1.post46.dev14423672753.dist-info/entry_points.txt,sha256=fj-e3PAQvsxsQzyyq8UkG1k8spunWnD4BAH2AwlR6NM,95
387
+ airbyte_cdk-6.45.1.post46.dev14423672753.dist-info/RECORD,,