diff --git a/airbyte-ci/connectors/pipelines/README.md b/airbyte-ci/connectors/pipelines/README.md index fe91df626d88..c32925164f3d 100644 --- a/airbyte-ci/connectors/pipelines/README.md +++ b/airbyte-ci/connectors/pipelines/README.md @@ -400,6 +400,7 @@ This command runs the Python tests for a airbyte-ci poetry package. ## Changelog | Version | PR | Description | | ------- | ---------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | +| 2.3.1 | [#31748](https://github.com/airbytehq/airbyte/pull/31748) | Use AsyncClick library instead of base Click. | | 2.3.0 | [#31699](https://github.com/airbytehq/airbyte/pull/31699) | Support optional concurrent CAT execution. | | 2.2.6 | [#31752](https://github.com/airbytehq/airbyte/pull/31752) | Only authenticate when secrets are available. | 2.2.5 | [#31718](https://github.com/airbytehq/airbyte/pull/31718) | Authenticate the sidecar docker daemon to DockerHub. | diff --git a/airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/connectors/build_image/commands.py b/airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/connectors/build_image/commands.py index 7c24e6766b2c..5bfee4be87df 100644 --- a/airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/connectors/build_image/commands.py +++ b/airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/connectors/build_image/commands.py @@ -2,8 +2,7 @@ # Copyright (c) 2023 Airbyte, Inc., all rights reserved. # -import anyio -import click +import asyncclick as click from pipelines.airbyte_ci.connectors.build_image.steps import run_connector_build_pipeline from pipelines.airbyte_ci.connectors.context import ConnectorContext from pipelines.airbyte_ci.connectors.pipeline import run_connectors_pipelines @@ -19,7 +18,7 @@ type=bool, ) @click.pass_context -def build(ctx: click.Context, use_host_gradle_dist_tar: bool) -> bool: +async def build(ctx: click.Context, use_host_gradle_dist_tar: bool) -> bool: """Runs a build pipeline for the selected connectors.""" connectors_contexts = [ @@ -47,8 +46,7 @@ def build(ctx: click.Context, use_host_gradle_dist_tar: bool) -> bool: ] if use_host_gradle_dist_tar and not ctx.obj["is_local"]: raise Exception("flag --use-host-gradle-dist-tar requires --is-local") - anyio.run( - run_connectors_pipelines, + await run_connectors_pipelines( connectors_contexts, run_connector_build_pipeline, "Build Pipeline", diff --git a/airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/connectors/bump_version/commands.py b/airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/connectors/bump_version/commands.py index 72d69ddba4cf..8cf692b08975 100644 --- a/airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/connectors/bump_version/commands.py +++ b/airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/connectors/bump_version/commands.py @@ -2,8 +2,7 @@ # Copyright (c) 2023 Airbyte, Inc., all rights reserved. # -import anyio -import click +import asyncclick as click from pipelines.airbyte_ci.connectors.bump_version.pipeline import run_connector_version_bump_pipeline from pipelines.airbyte_ci.connectors.context import ConnectorContext from pipelines.airbyte_ci.connectors.pipeline import run_connectors_pipelines @@ -15,7 +14,7 @@ @click.argument("pull-request-number", type=str) @click.argument("changelog-entry", type=str) @click.pass_context -def bump_version( +async def bump_version( ctx: click.Context, bump_type: str, pull_request_number: str, @@ -47,8 +46,7 @@ def bump_version( for connector in ctx.obj["selected_connectors_with_modified_files"] ] - anyio.run( - run_connectors_pipelines, + await run_connectors_pipelines( connectors_contexts, run_connector_version_bump_pipeline, "Version bump pipeline pipeline", diff --git a/airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/connectors/commands.py b/airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/connectors/commands.py index be99c29c70af..654584016150 100644 --- a/airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/connectors/commands.py +++ b/airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/connectors/commands.py @@ -6,7 +6,7 @@ from pathlib import Path from typing import List, Set, Tuple -import click +import asyncclick as click from connector_ops.utils import ConnectorLanguage, SupportLevelEnum, get_all_connectors_in_repo from pipelines import main_logger from pipelines.cli.lazy_group import LazyGroup @@ -192,7 +192,7 @@ def validate_environment(is_local: bool, use_remote_secrets: bool): envvar="DOCKER_HUB_PASSWORD", ) @click.pass_context -def connectors( +async def connectors( ctx: click.Context, use_remote_secrets: bool, names: Tuple[str], diff --git a/airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/connectors/list/commands.py b/airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/connectors/list/commands.py index b26b43176aae..4b0f54e6c462 100644 --- a/airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/connectors/list/commands.py +++ b/airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/connectors/list/commands.py @@ -2,7 +2,7 @@ # Copyright (c) 2023 Airbyte, Inc., all rights reserved. # -import click +import asyncclick as click from connector_ops.utils import console from pipelines.cli.dagger_pipeline_command import DaggerPipelineCommand from rich.table import Table @@ -11,7 +11,7 @@ @click.command(cls=DaggerPipelineCommand, help="List all selected connectors.") @click.pass_context -def list( +async def list( ctx: click.Context, ): selected_connectors = sorted(ctx.obj["selected_connectors_with_modified_files"], key=lambda x: x.technical_name) diff --git a/airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/connectors/migrate_to_base_image/commands.py b/airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/connectors/migrate_to_base_image/commands.py index c238a301fc69..9716c012cb77 100644 --- a/airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/connectors/migrate_to_base_image/commands.py +++ b/airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/connectors/migrate_to_base_image/commands.py @@ -2,8 +2,7 @@ # Copyright (c) 2023 Airbyte, Inc., all rights reserved. # -import anyio -import click +import asyncclick as click from pipelines.airbyte_ci.connectors.context import ConnectorContext from pipelines.airbyte_ci.connectors.migrate_to_base_image.pipeline import run_connector_migration_to_base_image_pipeline from pipelines.airbyte_ci.connectors.pipeline import run_connectors_pipelines @@ -17,7 +16,7 @@ ) @click.argument("pull-request-number", type=str) @click.pass_context -def migrate_to_base_image( +async def migrate_to_base_image( ctx: click.Context, pull_request_number: str, ) -> bool: @@ -51,8 +50,7 @@ def migrate_to_base_image( for connector in ctx.obj["selected_connectors_with_modified_files"] ] - anyio.run( - run_connectors_pipelines, + await run_connectors_pipelines( connectors_contexts, run_connector_migration_to_base_image_pipeline, "Migration to base image pipeline", diff --git a/airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/connectors/publish/commands.py b/airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/connectors/publish/commands.py index fd5bc65ebba9..2b48905d8f66 100644 --- a/airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/connectors/publish/commands.py +++ b/airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/connectors/publish/commands.py @@ -2,8 +2,7 @@ # Copyright (c) 2023 Airbyte, Inc., all rights reserved. # -import anyio -import click +import asyncclick as click from pipelines import main_logger from pipelines.airbyte_ci.connectors.pipeline import run_connectors_pipelines from pipelines.airbyte_ci.connectors.publish.context import PublishConnectorContext @@ -57,7 +56,7 @@ default="#connector-publish-updates", ) @click.pass_context -def publish( +async def publish( ctx: click.Context, pre_release: bool, spec_cache_gcs_credentials: str, @@ -113,8 +112,7 @@ def publish( main_logger.warn("Concurrency is forced to 1. For stability reasons we disable parallel publish pipelines.") ctx.obj["concurrency"] = 1 - publish_connector_contexts = anyio.run( - run_connectors_pipelines, + publish_connector_contexts = await run_connectors_pipelines( publish_connector_contexts, run_connector_publish_pipeline, "Publishing connectors", diff --git a/airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/connectors/test/commands.py b/airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/connectors/test/commands.py index e6f1f4f48fb7..71e120d92d8f 100644 --- a/airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/connectors/test/commands.py +++ b/airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/connectors/test/commands.py @@ -4,8 +4,7 @@ import sys -import anyio -import click +import asyncclick as click from pipelines import main_logger from pipelines.airbyte_ci.connectors.context import ConnectorContext from pipelines.airbyte_ci.connectors.pipeline import run_connectors_pipelines @@ -46,7 +45,7 @@ is_flag=True, ) @click.pass_context -def test( +async def test( ctx: click.Context, code_tests_only: bool, fail_fast: bool, @@ -100,8 +99,7 @@ def test( for connector in ctx.obj["selected_connectors_with_modified_files"] ] try: - anyio.run( - run_connectors_pipelines, + await run_connectors_pipelines( [connector_context for connector_context in connectors_tests_contexts], run_connector_test_pipeline, "Test Pipeline", diff --git a/airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/connectors/upgrade_base_image/commands.py b/airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/connectors/upgrade_base_image/commands.py index 755e2905744c..d1194ae7e14d 100644 --- a/airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/connectors/upgrade_base_image/commands.py +++ b/airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/connectors/upgrade_base_image/commands.py @@ -2,8 +2,7 @@ # Copyright (c) 2023 Airbyte, Inc., all rights reserved. # -import anyio -import click +import asyncclick as click from pipelines.airbyte_ci.connectors.context import ConnectorContext from pipelines.airbyte_ci.connectors.migrate_to_base_image.pipeline import run_connector_base_image_upgrade_pipeline from pipelines.airbyte_ci.connectors.pipeline import run_connectors_pipelines @@ -14,7 +13,7 @@ @click.command(cls=DaggerPipelineCommand, short_help="Upgrades the base image version used by the selected connectors.") @click.option("--set-if-not-exists", default=True) @click.pass_context -def upgrade_base_image(ctx: click.Context, set_if_not_exists: bool, docker_hub_username: str, docker_hub_password: str) -> bool: +async def upgrade_base_image(ctx: click.Context, set_if_not_exists: bool, docker_hub_username: str, docker_hub_password: str) -> bool: """Upgrades the base image version used by the selected connectors.""" fail_if_missing_docker_hub_creds(ctx) @@ -45,8 +44,7 @@ def upgrade_base_image(ctx: click.Context, set_if_not_exists: bool, docker_hub_u for connector in ctx.obj["selected_connectors_with_modified_files"] ] - anyio.run( - run_connectors_pipelines, + await run_connectors_pipelines( connectors_contexts, run_connector_base_image_upgrade_pipeline, "Upgrade base image pipeline", diff --git a/airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/metadata/commands.py b/airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/metadata/commands.py index f89aa6b42cfd..a7b92022b641 100644 --- a/airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/metadata/commands.py +++ b/airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/metadata/commands.py @@ -2,8 +2,7 @@ # Copyright (c) 2023 Airbyte, Inc., all rights reserved. # -import anyio -import click +import asyncclick as click from pipelines.airbyte_ci.metadata.pipeline import run_metadata_orchestrator_deploy_pipeline from pipelines.cli.dagger_pipeline_command import DaggerPipelineCommand @@ -24,9 +23,8 @@ def deploy(ctx: click.Context): @deploy.command(cls=DaggerPipelineCommand, name="orchestrator", help="Deploy the metadata service orchestrator to production") @click.pass_context -def deploy_orchestrator(ctx: click.Context) -> bool: - return anyio.run( - run_metadata_orchestrator_deploy_pipeline, +async def deploy_orchestrator(ctx: click.Context) -> bool: + await run_metadata_orchestrator_deploy_pipeline( ctx.obj["is_local"], ctx.obj["git_branch"], ctx.obj["git_revision"], diff --git a/airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/test/commands.py b/airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/test/commands.py index 97a370ac3f97..cf47f4168b5d 100644 --- a/airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/test/commands.py +++ b/airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/test/commands.py @@ -2,15 +2,14 @@ # Copyright (c) 2023 Airbyte, Inc., all rights reserved. # -import anyio -import click +import asyncclick as click from pipelines.airbyte_ci.test.pipeline import run_test @click.command() @click.argument("poetry_package_path") @click.option("--test-directory", default="tests", help="The directory containing the tests to run.") -def test( +async def test( poetry_package_path: str, test_directory: str, ): @@ -20,6 +19,6 @@ def test( poetry_package_path (str): Path to the poetry package to test, relative to airbyte-ci directory. test_directory (str): The directory containing the tests to run. """ - success = anyio.run(run_test, poetry_package_path, test_directory) + success = await run_test(poetry_package_path, test_directory) if not success: click.Abort() diff --git a/airbyte-ci/connectors/pipelines/pipelines/cli/airbyte_ci.py b/airbyte-ci/connectors/pipelines/pipelines/cli/airbyte_ci.py index 5256351700e8..d87314437310 100644 --- a/airbyte-ci/connectors/pipelines/pipelines/cli/airbyte_ci.py +++ b/airbyte-ci/connectors/pipelines/pipelines/cli/airbyte_ci.py @@ -10,7 +10,7 @@ from pathlib import Path from typing import List -import click +import asyncclick as click import git from github import PullRequest from pipelines import main_logger @@ -112,7 +112,7 @@ def set_working_directory_to_root() -> None: os.chdir(working_dir) -def get_modified_files( +async def get_modified_files( git_branch: str, git_revision: str, diffed_branch: str, is_local: bool, ci_context: CIContext, pull_request: PullRequest ) -> List[str]: """Get the list of modified files in the current git branch. @@ -125,15 +125,15 @@ def get_modified_files( This latest case is the one we encounter when running the pipeline locally, on a local branch, or manually on GHA with a workflow dispatch event. """ if ci_context is CIContext.MASTER or ci_context is CIContext.NIGHTLY_BUILDS: - return get_modified_files_in_commit(git_branch, git_revision, is_local) + return await get_modified_files_in_commit(git_branch, git_revision, is_local) if ci_context is CIContext.PULL_REQUEST and pull_request is not None: return get_modified_files_in_pull_request(pull_request) if ci_context is CIContext.MANUAL: if git_branch == "master": - return get_modified_files_in_commit(git_branch, git_revision, is_local) + return await get_modified_files_in_commit(git_branch, git_revision, is_local) else: - return get_modified_files_in_branch(git_branch, git_revision, diffed_branch, is_local) - return get_modified_files_in_branch(git_branch, git_revision, diffed_branch, is_local) + return await get_modified_files_in_branch(git_branch, git_revision, diffed_branch, is_local) + return await get_modified_files_in_branch(git_branch, git_revision, diffed_branch, is_local) # COMMANDS @@ -178,7 +178,7 @@ def get_modified_files( @click.option("--show-dagger-logs/--hide-dagger-logs", default=False, type=bool) @click.pass_context @track_command -def airbyte_ci( +async def airbyte_ci( ctx: click.Context, is_local: bool, git_branch: str, @@ -224,7 +224,7 @@ def airbyte_ci( ctx.obj["pull_request"] = None ctx.obj["modified_files"] = transform_strs_to_paths( - get_modified_files(git_branch, git_revision, diffed_branch, is_local, ci_context, ctx.obj["pull_request"]) + await get_modified_files(git_branch, git_revision, diffed_branch, is_local, ci_context, ctx.obj["pull_request"]) ) if not is_local: diff --git a/airbyte-ci/connectors/pipelines/pipelines/cli/dagger_pipeline_command.py b/airbyte-ci/connectors/pipelines/pipelines/cli/dagger_pipeline_command.py index efbb19a42813..2fed8450ebd6 100644 --- a/airbyte-ci/connectors/pipelines/pipelines/cli/dagger_pipeline_command.py +++ b/airbyte-ci/connectors/pipelines/pipelines/cli/dagger_pipeline_command.py @@ -10,7 +10,7 @@ from pathlib import Path from typing import Any -import click +import asyncclick as click from dagger import DaggerError from pipelines import consts, main_logger from pipelines.consts import GCS_PUBLIC_DOMAIN, STATIC_REPORT_PREFIX @@ -21,7 +21,7 @@ class DaggerPipelineCommand(click.Command): @sentry_utils.with_command_context - def invoke(self, ctx: click.Context) -> Any: + async def invoke(self, ctx: click.Context) -> Any: """Wrap parent invoke in a try catch suited to handle pipeline failures. Args: ctx (click.Context): The invocation context. @@ -49,7 +49,7 @@ def invoke(self, ctx: click.Context) -> Any: ctx.obj["dagger_logs_url"] = None else: ctx.obj["dagger_logs_path"] = None - pipeline_success = super().invoke(ctx) + pipeline_success = await super().invoke(ctx) if not pipeline_success: raise DaggerError(f"Dagger Command {command_name} failed.") except DaggerError as e: diff --git a/airbyte-ci/connectors/pipelines/pipelines/cli/lazy_group.py b/airbyte-ci/connectors/pipelines/pipelines/cli/lazy_group.py index a0a9e7aba6bc..c76c0a7c5477 100644 --- a/airbyte-ci/connectors/pipelines/pipelines/cli/lazy_group.py +++ b/airbyte-ci/connectors/pipelines/pipelines/cli/lazy_group.py @@ -3,7 +3,7 @@ import importlib from typing import Dict, List, Optional -import click +import asyncclick as click class LazyGroup(click.Group): @@ -39,5 +39,6 @@ def _lazy_load(self, cmd_name: str) -> click.BaseCommand: cmd_object = getattr(mod, cmd_object_name) # check the result to make debugging easier if not isinstance(cmd_object, click.BaseCommand): + print(f"{cmd_object} is of instance {type(cmd_object)}") raise ValueError(f"Lazy loading of {import_path} failed by returning " "a non-command object") return cmd_object diff --git a/airbyte-ci/connectors/pipelines/pipelines/helpers/git.py b/airbyte-ci/connectors/pipelines/pipelines/helpers/git.py index 0318f2e44d6e..ce822343b393 100644 --- a/airbyte-ci/connectors/pipelines/pipelines/helpers/git.py +++ b/airbyte-ci/connectors/pipelines/pipelines/helpers/git.py @@ -4,7 +4,6 @@ from typing import List, Set -import anyio import git from dagger import Connection from github import PullRequest @@ -64,12 +63,14 @@ def get_modified_files_in_branch_local(current_git_revision: str, diffed_branch: return set(modified_files) -def get_modified_files_in_branch(current_git_branch: str, current_git_revision: str, diffed_branch: str, is_local: bool = True) -> Set[str]: +async def get_modified_files_in_branch( + current_git_branch: str, current_git_revision: str, diffed_branch: str, is_local: bool = True +) -> Set[str]: """Retrieve the list of modified files on the branch.""" if is_local: return get_modified_files_in_branch_local(current_git_revision, diffed_branch) else: - return anyio.run(get_modified_files_in_branch_remote, current_git_branch, current_git_revision, diffed_branch) + return await get_modified_files_in_branch_remote(current_git_branch, current_git_revision, diffed_branch) async def get_modified_files_in_commit_remote(current_git_branch: str, current_git_revision: str) -> Set[str]: @@ -104,11 +105,11 @@ def get_modified_files_in_commit_local(current_git_revision: str) -> Set[str]: return set(modified_files) -def get_modified_files_in_commit(current_git_branch: str, current_git_revision: str, is_local: bool = True) -> Set[str]: +async def get_modified_files_in_commit(current_git_branch: str, current_git_revision: str, is_local: bool = True) -> Set[str]: if is_local: return get_modified_files_in_commit_local(current_git_revision) else: - return anyio.run(get_modified_files_in_commit_remote, current_git_branch, current_git_revision) + return await get_modified_files_in_commit_remote(current_git_branch, current_git_revision) def get_modified_files_in_pull_request(pull_request: PullRequest) -> List[str]: diff --git a/airbyte-ci/connectors/pipelines/poetry.lock b/airbyte-ci/connectors/pipelines/poetry.lock index 68b610e709d2..ab7b76b274a8 100644 --- a/airbyte-ci/connectors/pipelines/poetry.lock +++ b/airbyte-ci/connectors/pipelines/poetry.lock @@ -2,7 +2,7 @@ [[package]] name = "airbyte-connectors-base-images" -version = "0.1.0" +version = "0.1.1" description = "This package is used to generate and publish the base images for Airbyte Connectors." optional = false python-versions = "^3.10" @@ -68,6 +68,20 @@ doc = ["Sphinx", "packaging", "sphinx-autodoc-typehints (>=1.2.0)", "sphinx-rtd- test = ["anyio[trio]", "coverage[toml] (>=4.5)", "hypothesis (>=4.0)", "mock (>=4)", "psutil (>=5.9)", "pytest (>=7.0)", "pytest-mock (>=3.6.1)", "trustme", "uvloop (>=0.17)"] trio = ["trio (<0.22)"] +[[package]] +name = "asyncclick" +version = "8.1.3.4" +description = "Composable command line interface toolkit, async version" +optional = false +python-versions = ">=3.7" +files = [ + {file = "asyncclick-8.1.3.4-py3-none-any.whl", hash = "sha256:f8db604e37dabd43922d58f857817b1dfd8f88695b75c4cc1afe7ff1cc238a7b"}, + {file = "asyncclick-8.1.3.4.tar.gz", hash = "sha256:81d98cbf6c8813f9cd5599f586d56cfc532e9e6441391974d10827abb90fe833"}, +] + +[package.dependencies] +colorama = {version = "*", markers = "platform_system == \"Windows\""} + [[package]] name = "asyncer" version = "0.0.2" @@ -82,16 +96,6 @@ files = [ [package.dependencies] anyio = ">=3.4.0,<4.0.0" -[[package]] -name = "atomicwrites" -version = "1.4.1" -description = "Atomic file writes." -optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" -files = [ - {file = "atomicwrites-1.4.1.tar.gz", hash = "sha256:81b2c9071a49367a7f770170e5eec8cb66567cfbbc8c73d20ce5ca4a8d71cf11"}, -] - [[package]] name = "attrs" version = "23.1.0" @@ -1410,17 +1414,6 @@ files = [ {file = "protobuf-4.24.4.tar.gz", hash = "sha256:5a70731910cd9104762161719c3d883c960151eea077134458503723b60e3667"}, ] -[[package]] -name = "py" -version = "1.11.0" -description = "library with cross-python path, ini-parsing, io, code, log facilities" -optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" -files = [ - {file = "py-1.11.0-py2.py3-none-any.whl", hash = "sha256:607c53218732647dff4acdfcd50cb62615cedf612e72d1724fb1a0cc6405b378"}, - {file = "py-1.11.0.tar.gz", hash = "sha256:51c75c4126074b472f746a24399ad32f6053d1b34b68d2fa41e558e6f4a98719"}, -] - [[package]] name = "pyasn1" version = "0.5.0" @@ -1604,27 +1597,43 @@ tests = ["hypothesis (>=3.27.0)", "pytest (>=3.2.1,!=3.3.0)"] [[package]] name = "pytest" -version = "6.2.5" +version = "7.4.2" description = "pytest: simple powerful testing with Python" optional = false -python-versions = ">=3.6" +python-versions = ">=3.7" files = [ - {file = "pytest-6.2.5-py3-none-any.whl", hash = "sha256:7310f8d27bc79ced999e760ca304d69f6ba6c6649c0b60fb0e04a4a77cacc134"}, - {file = "pytest-6.2.5.tar.gz", hash = "sha256:131b36680866a76e6781d13f101efb86cf674ebb9762eb70d3082b6f29889e89"}, + {file = "pytest-7.4.2-py3-none-any.whl", hash = "sha256:1d881c6124e08ff0a1bb75ba3ec0bfd8b5354a01c194ddd5a0a870a48d99b002"}, + {file = "pytest-7.4.2.tar.gz", hash = "sha256:a766259cfab564a2ad52cb1aae1b881a75c3eb7e34ca3779697c23ed47c47069"}, ] [package.dependencies] -atomicwrites = {version = ">=1.0", markers = "sys_platform == \"win32\""} -attrs = ">=19.2.0" colorama = {version = "*", markers = "sys_platform == \"win32\""} +exceptiongroup = {version = ">=1.0.0rc8", markers = "python_version < \"3.11\""} iniconfig = "*" packaging = "*" pluggy = ">=0.12,<2.0" -py = ">=1.8.2" -toml = "*" +tomli = {version = ">=1.0.0", markers = "python_version < \"3.11\""} + +[package.extras] +testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"] + +[[package]] +name = "pytest-asyncio" +version = "0.21.1" +description = "Pytest support for asyncio" +optional = false +python-versions = ">=3.7" +files = [ + {file = "pytest-asyncio-0.21.1.tar.gz", hash = "sha256:40a7eae6dded22c7b604986855ea48400ab15b069ae38116e8c01238e9eeb64d"}, + {file = "pytest_asyncio-0.21.1-py3-none-any.whl", hash = "sha256:8666c1c8ac02631d7c51ba282e0c69a8a452b211ffedf2599099845da5c5c37b"}, +] + +[package.dependencies] +pytest = ">=7.0.0" [package.extras] -testing = ["argcomplete", "hypothesis (>=3.56)", "mock", "nose", "requests", "xmlschema"] +docs = ["sphinx (>=5.3)", "sphinx-rtd-theme (>=1.0)"] +testing = ["coverage (>=6.2)", "flaky (>=3.5.0)", "hypothesis (>=5.7.1)", "mypy (>=0.931)", "pytest-trio (>=0.7.0)"] [[package]] name = "pytest-cov" @@ -2248,4 +2257,4 @@ multidict = ">=4.0" [metadata] lock-version = "2.0" python-versions = "~3.10" -content-hash = "76b53958ee6dd19c2816b023cce1585bb198e14c79124d56de2445c494d51cf2" +content-hash = "218614039c4441f74ade0bfc19f7f9d67c04bdb6b94f68da1f38b88a2774cbc0" diff --git a/airbyte-ci/connectors/pipelines/pyproject.toml b/airbyte-ci/connectors/pipelines/pyproject.toml index 3fe3a7eb34b5..82e7a5a3300a 100644 --- a/airbyte-ci/connectors/pipelines/pyproject.toml +++ b/airbyte-ci/connectors/pipelines/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api" [tool.poetry] name = "pipelines" -version = "2.3.0" +version = "2.3.1" description = "Packaged maintained by the connector operations team to perform CI for connectors' pipelines" authors = ["Airbyte "] @@ -25,10 +25,12 @@ connector-ops = {path = "../connector_ops", develop = true} toml = "^0.10.2" sentry-sdk = "^1.28.1" segment-analytics-python = "^2.2.3" +asyncclick = "^8.1.3.4" [tool.poetry.group.test.dependencies] -pytest = "^6.2.5" +pytest = "^7.0.0" pytest-mock = "^3.10.0" +pytest-asyncio = "^0.21.1" [tool.poetry.group.dev.dependencies] diff --git a/airbyte-ci/connectors/pipelines/tests/test_commands/test_groups/test_connectors.py b/airbyte-ci/connectors/pipelines/tests/test_commands/test_groups/test_connectors.py index 0420bbef0096..b83b2853985d 100644 --- a/airbyte-ci/connectors/pipelines/tests/test_commands/test_groups/test_connectors.py +++ b/airbyte-ci/connectors/pipelines/tests/test_commands/test_groups/test_connectors.py @@ -4,9 +4,9 @@ from typing import Callable -import click +import asyncclick as click import pytest -from click.testing import CliRunner +from asyncclick.testing import CliRunner from connector_ops.utils import METADATA_FILE_NAME, ConnectorLanguage from pipelines.airbyte_ci.connectors import commands as connectors_commands from pipelines.airbyte_ci.connectors.build_image import commands as connectors_build_command @@ -271,7 +271,8 @@ def click_context_obj(): (connectors_build_command.build, []), ], ) -def test_commands_do_not_override_connector_selection( +@pytest.mark.asyncio +async def test_commands_do_not_override_connector_selection( mocker, runner: CliRunner, click_context_obj: dict, command: Callable, command_args: list ): """ @@ -287,7 +288,7 @@ def test_commands_do_not_override_connector_selection( mocker.patch.object(connectors_test_command, "ConnectorContext", mock_connector_context) mocker.patch.object(connectors_build_command, "ConnectorContext", mock_connector_context) mocker.patch.object(connectors_publish_command, "PublishConnectorContext", mock_connector_context) - runner.invoke(command, command_args, catch_exceptions=True, obj=click_context_obj) + await runner.invoke(command, command_args, catch_exceptions=True, obj=click_context_obj) assert mock_connector_context.call_count == 1 # If the connector selection is overriden the context won't be instantiated with the selected connector mock instance assert mock_connector_context.call_args_list[0].kwargs["connector"] == selected_connector