Skip to content

Commit 3798fb4

Browse files
fix: Resolve Pydantic frozen instance error in connector_base.py
- Convert relative paths to absolute paths before creating frozen ConnectorTestScenario models - Fixes PyTest failures in CI by preventing attempts to modify frozen Pydantic instances - Local tests now pass: 7 passed, 1 skipped Co-Authored-By: AJ Steers <aj@airbyte.io>
1 parent 6319699 commit 3798fb4

File tree

1 file changed

+10
-14
lines changed

1 file changed

+10
-14
lines changed

airbyte_cdk/test/standard_tests/connector_base.py

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -169,26 +169,22 @@ def get_scenarios(
169169
)
170170

171171
test_scenarios: list[ConnectorTestScenario] = []
172+
connector_root = cls.get_connector_root_dir().absolute()
173+
172174
for category in categories:
173175
if (
174176
category not in all_tests_config["acceptance_tests"]
175177
or "tests" not in all_tests_config["acceptance_tests"][category]
176178
):
177179
continue
178180

179-
test_scenarios.extend(
180-
[
181-
ConnectorTestScenario.model_validate(test)
182-
for test in all_tests_config["acceptance_tests"][category]["tests"]
183-
if "config_path" in test and "iam_role" not in test["config_path"]
184-
]
185-
)
186-
187-
connector_root = cls.get_connector_root_dir().absolute()
188-
for test in test_scenarios:
189-
if test.config_path:
190-
test.config_path = connector_root / test.config_path
191-
if test.configured_catalog_path:
192-
test.configured_catalog_path = connector_root / test.configured_catalog_path
181+
for test in all_tests_config["acceptance_tests"][category]["tests"]:
182+
if "config_path" in test and "iam_role" not in test["config_path"]:
183+
if "config_path" in test and test["config_path"]:
184+
test["config_path"] = str(connector_root / test["config_path"])
185+
if "configured_catalog_path" in test and test["configured_catalog_path"]:
186+
test["configured_catalog_path"] = str(connector_root / test["configured_catalog_path"])
187+
188+
test_scenarios.append(ConnectorTestScenario.model_validate(test))
193189

194190
return test_scenarios

0 commit comments

Comments
 (0)