Skip to content

feat(standard-tests): build sources that require catalog, config and state - #1232

Draft
Anatolii Yatsuk (tolik0) wants to merge 1 commit into
mainfrom
tolik0/cdk/python-connector-test-support
Draft

Anatolii Yatsuk (tolik0) wants to merge 1 commit into
mainfrom
tolik0/cdk/python-connector-test-support

Conversation

@tolik0

@tolik0 Anatolii Yatsuk (tolik0) commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

No connector changes behaviour until it pins the release. Once one does, the in-process suite builds Python sources that require catalog, config and state by itself, and the 7 sources of suite group 1 in airbytehq/airbyte#88940 can delete their integration_tests/standard_tests.py.

What

The in-process Standard Tests (SourceTestSuiteBase, used by airbyte-cdk connector test and by create_connector_test_suite()) now build Python sources the way their run.py does:

  • create_connector() inspects the constructor (or factory) signature.
    • When it requires catalog, config or state, the suite passes the scenario's config (an empty dict when there is none) and None for catalog and state, as run.py passes them when it launches without a catalog or state.
    • An optional config also gets the scenario's config, when the scenario has one, since run.py always passes --config.
    • Any other required argument raises a TypeError that names it and says how to work around it.
  • When the class accepts catalog, config or state (required or optional), its read is done by a source built from the read command's catalog, config and state, again as run.py builds it.

Why

The suite called the connector class with no arguments. Python sources built on YamlDeclarativeSource, FileBasedSource or ConcurrentSourceAdapter require catalog, config and state, so every in-process test of those connectors failed with a TypeError before reaching the connector. This blocks running the suite in connector CI (airbytehq/airbyte-internal-issues#17133) for source-asana, source-freshcaller, source-google-ads, source-google-drive, source-microsoft-sharepoint, source-salesforce and source-sftp-bulk.

Two kinds of source also need to be built with the command's own arguments:

  • A file-based source takes its stream schemas from the catalog it is built with. Built without one, every read fails with a missing json_schema error.
  • A declarative Python source with an optional config (source-facebook-pages) evaluates the config in its components when it is built. Built without one, check and read send requests with empty config values.

Verification

  • poetry run pytest unit_tests/test/ -p no:cacheprovider: 795 passed, 9 skipped. The new unit tests cover:
    • a source built for the read command;
    • a source with an optional config, with and without a scenario config;
    • a source with no arguments, which keeps its own read.
  • ruff format --check, ruff check and mypy airbyte_cdk/test are clean.
  • Connector check: this branch was installed into the Poetry environments of source-facebook-pages, source-google-drive and source-asana, then the generated suite ran with no connector-side suite file.
    • source-facebook-pages passes (6 passed).
    • source-google-drive passes (9 passed).
    • source-asana now reaches the connector and fails only check, on its test credentials, which are known to be invalid (it already fails airbyte-cdk image test).

Related PRs

This PR is part of airbytehq/airbyte-internal-issues#17133. It waits for no monorepo PR, and none of them waits for it: the new connector CI step runs each connector's pinned CDK, and the monorepo suite files build these sources themselves until a connector pins a release with this change.

Migration

cdk-migrations.md gets a new section under "Upgrading to the next minor release (unreleased)". No action is needed for most connectors. Connectors that override create_connector() only to pass catalog, config and state can drop the override once they pin this release. The airbyte monorepo adds such overrides as integration_tests/standard_tests.py (airbytehq/airbyte#88940).

🤖 Generated with Claude Code

…state

The in-process Standard Tests called the connector class with no arguments. Python sources
built on YamlDeclarativeSource, FileBasedSource or ConcurrentSourceAdapter require catalog,
config and state, so every in-process test of those connectors failed with a TypeError before
reaching the connector. That blocks running the suite in connector CI (airbyte-internal-issues
#17133) for asana, freshcaller, google-ads, google-drive, microsoft-sharepoint, salesforce and
sftp-bulk.

create_connector() now inspects the signature and passes config from the scenario (an empty
dict when there is none) and None for catalog and state, matching what run.py passes when it
launches without them. Any other required argument raises a TypeError naming it, since the
suite cannot guess it.

An optional config also receives the scenario's config when there is one, as run.py passes
--config. When the class accepts catalog, config or state, required or optional, its read is
done by a source built from the read command's catalog, config and state, as run.py builds it. A
file-based source takes its stream schemas from the catalog it is built with, so a source built
without one fails every read with a missing json_schema error. A declarative Python source with
an optional config (source-facebook-pages) evaluates the config in its components when it is
built, so a source built without one sends requests with empty config values.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

👋 Greetings, Airbyte Team Member!

Here are some helpful tips and reminders for your convenience.

💡 Show Tips and Tricks

Testing This CDK Version

You can test this version of the CDK using the following:

# Run the CLI from this branch:
uvx 'git+https://github.com/airbytehq/airbyte-python-cdk.git@tolik0/cdk/python-connector-test-support#egg=airbyte-python-cdk[dev]' --help

# Update a connector to use the CDK from this branch ref:
cd airbyte-integrations/connectors/source-example
poe use-cdk-branch tolik0/cdk/python-connector-test-support

PR Slash Commands

Airbyte Maintainers can execute the following slash commands on your PR:

  • /autofix - Fixes most formatting and linting issues
  • /poetry-lock - Updates poetry.lock file
  • /test - Runs connector tests with the updated CDK
  • /prerelease - Triggers a prerelease publish with default arguments
  • /poe build - Regenerate git-committed build artifacts, such as the pydantic models which are generated from the manifest JSON schema in YAML.
  • /poe <command> - Runs any poe command in the CDK environment
📚 Show Repo Guidance

Helpful Resources

📝 Edit this welcome message.

AirbyteStateMessage,
ConfiguredAirbyteCatalog,
)
from airbyte_cdk.sources.source import Source
@github-actions

Copy link
Copy Markdown

PyTest Results (Fast)

5 759 tests  +11   5 728 ✅ +10   12m 54s ⏱️ +44s
    1 suites ± 0      31 💤 + 1 
    1 files   ± 0       0 ❌ ± 0 

Results for commit 88a1d44. ± Comparison against base commit 2082c2d.

This pull request skips 1 test.
unit_tests.resources.source_pokeapi_w_components_py.integration_tests.test_airbyte_standards.TestSuiteSourcePokeAPI ‑ test_docker_image_spec_backward_compatibility

@github-actions

Copy link
Copy Markdown

PyTest Results (Full)

5 762 tests  +11   5 731 ✅ +10   13m 29s ⏱️ - 3m 31s
    1 suites ± 0      31 💤 + 1 
    1 files   ± 0       0 ❌ ± 0 

Results for commit 88a1d44. ± Comparison against base commit 2082c2d.

This pull request skips 1 test.
unit_tests.resources.source_pokeapi_w_components_py.integration_tests.test_airbyte_standards.TestSuiteSourcePokeAPI ‑ test_docker_image_spec_backward_compatibility

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant