Skip to content

Commit c8e7722

Browse files
committed
misc fixes
1 parent 42d8a4e commit c8e7722

File tree

1 file changed

+21
-9
lines changed

1 file changed

+21
-9
lines changed

airbyte_cdk/test/declarative/test_suites/connector_base.py

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,21 @@
2929
ACCEPTANCE_TEST_CONFIG = "acceptance-test-config.yml"
3030

3131

32+
class JavaClass(str):
33+
"""A string that represents a Java class."""
34+
35+
36+
class DockerImage(str):
37+
"""A string that represents a Docker image."""
38+
39+
40+
class RunnableConnector(abc.ABC):
41+
"""A connector that can be run in a test scenario."""
42+
43+
@abc.abstractmethod
44+
def launch(cls, args: list[str] | None): ...
45+
46+
3247
def generate_tests(metafunc):
3348
"""
3449
A helper for pytest_generate_tests hook.
@@ -83,22 +98,19 @@ class ConnectorTestSuiteBase(abc.ABC):
8398
the root of the connector source directory.
8499
"""
85100

86-
connector_class: type[Connector]
87-
"""The connector class to test."""
101+
connector: type[Connector] | Path | JavaClass | DockerImage | None = None
102+
"""The connector class or path to the connector to test."""
88103

89104
working_dir: Path | None = None
90105
"""The root directory of the connector source code."""
91106

92107
@override
93108
@classmethod
94-
def create_connector(cls, scenario: ConnectorTestScenario) -> ConcurrentDeclarativeSource:
109+
def create_connector(
110+
cls, scenario: ConnectorTestScenario
111+
) -> Source | ConcurrentDeclarativeSource | RunnableConnector:
95112
"""Instantiate the connector class."""
96-
return ConcurrentDeclarativeSource(
97-
config=scenario.get_config_dict(),
98-
catalog={},
99-
state=None,
100-
source_config={},
101-
)
113+
raise NotImplementedError("Subclasses must implement this method.")
102114

103115
def run_test_scenario(
104116
self,

0 commit comments

Comments
 (0)