Preparing next release
- More typing - All failing mypy tests fixed
This commit is contained in:
parent
9b744d8b4c
commit
8c888d450a
|
@ -6,14 +6,14 @@ from _pytest.config import Config
|
|||
from _ptcsvp.plugin import Plugin
|
||||
|
||||
|
||||
def pytest_configure(config: Config, plugin_name="csv_params") -> None:
|
||||
def pytest_configure(config: Config, plugin_name: str = "csv_params") -> None:
|
||||
"""
|
||||
Register our Plugin
|
||||
"""
|
||||
config.pluginmanager.register(Plugin(config), f"{plugin_name}_plugin")
|
||||
|
||||
|
||||
def pytest_unconfigure(config: Config, plugin_name="csv_params") -> None:
|
||||
def pytest_unconfigure(config: Config, plugin_name: str = "csv_params") -> None:
|
||||
"""
|
||||
Remove our Plugin
|
||||
"""
|
||||
|
|
|
@ -6,6 +6,7 @@ from pathlib import Path
|
|||
from typing import Any, List, Optional, TypedDict
|
||||
|
||||
import pytest
|
||||
from _pytest.mark import MarkDecorator
|
||||
|
||||
from _ptcsvp.plugin import BASE_DIR_KEY, Plugin
|
||||
from pytest_csv_params.dialect import CsvParamsDefaultDialect
|
||||
|
@ -14,7 +15,7 @@ from pytest_csv_params.exception import (
|
|||
CsvParamsDataFileInvalid,
|
||||
CsvParamsDataFileNotFound,
|
||||
)
|
||||
from pytest_csv_params.types import BaseDir, CsvDialect, DataCastDict, DataFile, IdColName
|
||||
from pytest_csv_params.types import BaseDir, CsvDialect, DataCasts, DataFile, IdColName
|
||||
|
||||
|
||||
class TestCaseParameters(TypedDict):
|
||||
|
@ -56,9 +57,9 @@ def add_parametrization(
|
|||
data_file: DataFile,
|
||||
base_dir: BaseDir = None,
|
||||
id_col: IdColName = None,
|
||||
data_casts: DataCastDict = None,
|
||||
data_casts: DataCasts = None,
|
||||
dialect: CsvDialect = CsvParamsDefaultDialect,
|
||||
):
|
||||
) -> MarkDecorator:
|
||||
"""
|
||||
Get data from the files and add things to the tests
|
||||
"""
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
The main Plugin implementation
|
||||
"""
|
||||
|
||||
from _pytest.config import Config
|
||||
|
||||
BASE_DIR_KEY = "__pytest_csv_plugins__config__base_dir"
|
||||
|
||||
|
@ -11,7 +12,7 @@ class Plugin: # pylint: disable=too-few-public-methods
|
|||
Plugin Class
|
||||
"""
|
||||
|
||||
def __init__(self, config) -> None:
|
||||
def __init__(self, config: Config) -> None:
|
||||
"""
|
||||
Hold the pytest config
|
||||
"""
|
||||
|
|
|
@ -2,12 +2,11 @@
|
|||
Types to ease the usage of the API
|
||||
"""
|
||||
import csv
|
||||
from typing import Callable, Dict, Optional, Type, TypeVar
|
||||
from typing import Any, Callable, Dict, Optional, Type
|
||||
|
||||
T = TypeVar("T")
|
||||
|
||||
DataCast = Callable[[str], T]
|
||||
DataCast = Callable[[str], Any]
|
||||
DataCastDict = Dict[str, DataCast]
|
||||
DataCasts = Optional[DataCastDict]
|
||||
|
||||
BaseDir = Optional[str]
|
||||
IdColName = Optional[str]
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
Test the Parametrization Feature
|
||||
"""
|
||||
from os.path import dirname, join
|
||||
from typing import List, Optional, Tuple
|
||||
from typing import List, Optional, Tuple, Type
|
||||
|
||||
import pytest
|
||||
|
||||
|
@ -82,7 +82,7 @@ def test_parametrization( # pylint: disable=too-many-arguments
|
|||
id_col: Optional[str],
|
||||
result: Optional[Tuple[List[str], List[List[str]]]],
|
||||
ids: Optional[List[str]],
|
||||
expect_exception: Optional[Exception],
|
||||
expect_exception: Optional[Type[Exception]],
|
||||
expect_message: Optional[str],
|
||||
) -> None:
|
||||
"""
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
Test the reading of the CSV
|
||||
"""
|
||||
from os.path import dirname, join
|
||||
from typing import Optional
|
||||
from typing import Optional, Type
|
||||
|
||||
import pytest
|
||||
|
||||
|
@ -35,10 +35,10 @@ from pytest_csv_params.exception import CsvParamsDataFileInvalid, CsvParamsDataF
|
|||
],
|
||||
)
|
||||
def test_csv_reader(
|
||||
csv_file: Optional[str],
|
||||
csv_file: str,
|
||||
base_dir: Optional[str],
|
||||
expect_lines: Optional[int],
|
||||
expect_exception: Optional[Exception],
|
||||
expect_exception: Optional[Type[Exception]],
|
||||
expect_message: Optional[str],
|
||||
) -> None:
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue