Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions airbyte_cdk/cli/airbyte_cdk/_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,18 @@ def connector_cli_group() -> None:
multiple=True,
help="Additional argument(s) to pass to pytest. Can be specified multiple times.",
)
@click.option(
"--no-creds",
is_flag=True,
default=False,
help="Skip tests that require credentials (marked with 'requires_creds').",
)
def connector_test(
connector: str | Path | None = None,
*,
collect_only: bool = False,
pytest_args: list[str] | None = None,
no_creds: bool = False,
) -> None:
"""Run connector tests.

Expand All @@ -147,6 +154,9 @@ def connector_test(
if collect_only:
pytest_args.append("--collect-only")

if no_creds:
pytest_args.extend(["-m", "not requires_creds"])

run_connector_tests(
connector_name=connector_name,
connector_directory=connector_directory,
Expand Down
9 changes: 8 additions & 1 deletion airbyte_cdk/cli/airbyte_cdk/_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,17 @@ def build(
"--image",
help="Image to test, instead of building a new one.",
)
@click.option(
"--no-creds",
is_flag=True,
default=False,
help="Skip tests that require credentials (marked with 'requires_creds').",
)
def image_test( # "image test" command
connector: str | None = None,
*,
image: str | None = None,
no_creds: bool = False,
) -> None:
"""Test a connector Docker image.

Expand All @@ -124,7 +131,7 @@ def image_test( # "image test" command
connector_name, connector_directory = resolve_connector_name_and_directory(connector)

# Select only tests with the 'image_tests' mark
pytest_args = ["-m", "image_tests"]
pytest_args = ["-m", "image_tests and not requires_creds" if no_creds else "image_tests"]
if not image:
metadata_file_path: Path = connector_directory / "metadata.yaml"
try:
Expand Down
Loading