From 0cec8c42c0a3c994285b93db5ee2881042586672 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Gon=C3=A7alves?= Date: Thu, 6 Oct 2022 22:33:48 +0200 Subject: wip: decorator + arguments tests --- tests/conftest.py | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'tests/conftest.py') diff --git a/tests/conftest.py b/tests/conftest.py index e598a79..7d5e2c7 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,7 +1,10 @@ +import click +import pytest + from enum import Enum from pydantic import BaseModel, Field - -import pytest +from pydanclick import core +from typing import Generator class GenericArguments(BaseModel): @@ -15,3 +18,24 @@ class GenericArguments(BaseModel): version: int = Field(gt=0) force: bool = Field(default=False, description="Force ABC.") fruit: FruitEnum + + +@pytest.fixture +def valid_arguments() -> Generator[GenericArguments, None, None]: + yield GenericArguments( + name="fruit_manager", + version=12, + force=True, + fruit="pineapple", + ) + + +@pytest.fixture +def valid_command_entrypoint() -> Generator[click.Command, None, None]: + + @click.command() + @core.generate_cli_options() + def entrypoint(parameters: GenericArguments): + pass + + yield entrypoint -- cgit v1.2.3