diff options
author | Romain Gonçalves <me@rgoncalves.se> | 2022-10-06 22:33:48 +0200 |
---|---|---|
committer | Romain Gonçalves <me@rgoncalves.se> | 2022-10-06 22:33:48 +0200 |
commit | 0cec8c42c0a3c994285b93db5ee2881042586672 (patch) | |
tree | 7aee09c4955506a8654286018345364a08bb48cf /tests/conftest.py | |
parent | a66d538e8d3213b185d1dda6ebb44d22e7fdc707 (diff) | |
download | pydanclick-0cec8c42c0a3c994285b93db5ee2881042586672.tar.gz |
wip: decorator + arguments tests
Diffstat (limited to 'tests/conftest.py')
-rw-r--r-- | tests/conftest.py | 28 |
1 files changed, 26 insertions, 2 deletions
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 |