diff --git a/.github/workflows/linters.yaml b/.github/workflows/linters.yaml index 95584c6..06bc566 100644 --- a/.github/workflows/linters.yaml +++ b/.github/workflows/linters.yaml @@ -28,7 +28,20 @@ jobs: - name: Check out uses: actions/checkout@v3 + - name: Install poetry + run: pipx install poetry + - name: Set up python environment uses: actions/setup-python@v4 + with: + cache: 'poetry' + + - run: poetry install --no-root --with=dev --sync + + - uses: actions/cache@v3 + with: + path: ~/.cache/pre-commit + key: pre-commit-3|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }} - - uses: pre-commit/action@v3.0.0 + - run: poetry run pre-commit run --show-diff-on-failure --color=always --all-files + shell: bash diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4663709..02d9ab7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -14,6 +14,15 @@ repos: hooks: - id: black + - repo: local + hooks: + - id: mypy + name: mypy + entry: poetry run mypy + require_serial: true + language: system + types: [python] + - repo: https://github.com/pre-commit/pre-commit-hooks rev: "v4.4.0" hooks: diff --git a/podcast_archiver/argparse.py b/podcast_archiver/argparse.py index c367892..6b07f95 100644 --- a/podcast_archiver/argparse.py +++ b/podcast_archiver/argparse.py @@ -7,7 +7,8 @@ from pydantic import types if TYPE_CHECKING: - from pydantic import BaseSettings, ModelField + from pydantic import BaseSettings + from pydantic.fields import ModelField class readable_file(argparse.Action): diff --git a/podcast_archiver/config.py b/podcast_archiver/config.py index 194b204..78459e5 100644 --- a/podcast_archiver/config.py +++ b/podcast_archiver/config.py @@ -2,7 +2,7 @@ import textwrap from pathlib import Path -from typing import TYPE_CHECKING, Union +from typing import TYPE_CHECKING, Any, Union from pydantic import BaseSettings, DirectoryPath, Field, FilePath, validator from yaml import safe_load @@ -95,13 +95,13 @@ class Config: ) @validator("archive_directory", pre=True) - def normalize_archive_directory(cls, v): + def normalize_archive_directory(cls, v) -> Path: if v is None: return Path.cwd() return Path(v).expanduser() @validator("opml_files", pre=True, each_item=True) - def normalize_opml_files(cls, v): + def normalize_opml_files(cls, v: Any) -> Path: return Path(v).expanduser() @classmethod @@ -111,7 +111,7 @@ def load_from_yaml(cls, path: Union[Path, None]) -> Settings: content = safe_load(filep) if content: return cls.parse_obj(content) - return cls() + return cls() # type: ignore[call-arg] @classmethod def load_and_merge(cls, path: Union[Path, None], args: argparse.Namespace): @@ -132,7 +132,7 @@ def load_and_merge(cls, path: Union[Path, None], args: argparse.Namespace): return cls.parse_obj(merged_settings) @classmethod - def generate_example(cls, path: Path) -> str: + def generate_example(cls, path: Path) -> None: text = ["## Configuration for podcast-archiver"] text.append(f"## Generated with version {__version__}\n") for name, field in cls.__fields__.items(): diff --git a/poetry.lock b/poetry.lock index 1416589..31fcf5f 100644 --- a/poetry.lock +++ b/poetry.lock @@ -104,6 +104,18 @@ files = [ {file = "certifi-2022.12.7.tar.gz", hash = "sha256:35824b4c3a97115964b408844d64aa14db1cc518f6562e8d7261699d1350a9e3"}, ] +[[package]] +name = "cfgv" +version = "3.3.1" +description = "Validate configuration and produce human readable error messages." +category = "dev" +optional = false +python-versions = ">=3.6.1" +files = [ + {file = "cfgv-3.3.1-py2.py3-none-any.whl", hash = "sha256:c6a0883f3917a037485059700b9e75da2464e6c27051014ad85ba6aaa5884426"}, + {file = "cfgv-3.3.1.tar.gz", hash = "sha256:f5a830efb9ce7a445376bb66ec94c638a9787422f96264c98edc6bdeed8ab736"}, +] + [[package]] name = "charset-normalizer" version = "3.1.0" @@ -295,6 +307,18 @@ files = [ {file = "decorator-5.1.1.tar.gz", hash = "sha256:637996211036b6385ef91435e4fae22989472f9d571faba8927ba8253acbc330"}, ] +[[package]] +name = "distlib" +version = "0.3.6" +description = "Distribution utilities" +category = "dev" +optional = false +python-versions = "*" +files = [ + {file = "distlib-0.3.6-py2.py3-none-any.whl", hash = "sha256:f35c4b692542ca110de7ef0bea44d73981caeb34ca0b9b6b2e6d7790dda8f80e"}, + {file = "distlib-0.3.6.tar.gz", hash = "sha256:14bad2d9b04d3a36127ac97f30b12a19268f211063d8f8ee4f47108896e11b46"}, +] + [[package]] name = "exceptiongroup" version = "1.1.1" @@ -340,6 +364,37 @@ files = [ [package.dependencies] sgmllib3k = "*" +[[package]] +name = "filelock" +version = "3.12.0" +description = "A platform independent file lock." +category = "dev" +optional = false +python-versions = ">=3.7" +files = [ + {file = "filelock-3.12.0-py3-none-any.whl", hash = "sha256:ad98852315c2ab702aeb628412cbf7e95b7ce8c3bf9565670b4eaecf1db370a9"}, + {file = "filelock-3.12.0.tar.gz", hash = "sha256:fc03ae43288c013d2ea83c8597001b1129db351aad9c57fe2409327916b8e718"}, +] + +[package.extras] +docs = ["furo (>=2023.3.27)", "sphinx (>=6.1.3)", "sphinx-autodoc-typehints (>=1.23,!=1.23.4)"] +testing = ["covdefaults (>=2.3)", "coverage (>=7.2.3)", "diff-cover (>=7.5)", "pytest (>=7.3.1)", "pytest-cov (>=4)", "pytest-mock (>=3.10)", "pytest-timeout (>=2.1)"] + +[[package]] +name = "identify" +version = "2.5.23" +description = "File identification library for Python" +category = "dev" +optional = false +python-versions = ">=3.7" +files = [ + {file = "identify-2.5.23-py2.py3-none-any.whl", hash = "sha256:17d9351c028a781456965e781ed2a435755cac655df1ebd930f7186b54399312"}, + {file = "identify-2.5.23.tar.gz", hash = "sha256:50b01b9d5f73c6b53e5fa2caf9f543d3e657a9d0bbdeb203ebb8d45960ba7433"}, +] + +[package.extras] +license = ["ukkonen"] + [[package]] name = "idna" version = "3.4" @@ -439,6 +494,53 @@ files = [ [package.dependencies] traitlets = "*" +[[package]] +name = "mypy" +version = "1.2.0" +description = "Optional static typing for Python" +category = "dev" +optional = false +python-versions = ">=3.7" +files = [ + {file = "mypy-1.2.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:701189408b460a2ff42b984e6bd45c3f41f0ac9f5f58b8873bbedc511900086d"}, + {file = "mypy-1.2.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:fe91be1c51c90e2afe6827601ca14353bbf3953f343c2129fa1e247d55fd95ba"}, + {file = "mypy-1.2.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8d26b513225ffd3eacece727f4387bdce6469192ef029ca9dd469940158bc89e"}, + {file = "mypy-1.2.0-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:3a2d219775a120581a0ae8ca392b31f238d452729adbcb6892fa89688cb8306a"}, + {file = "mypy-1.2.0-cp310-cp310-win_amd64.whl", hash = "sha256:2e93a8a553e0394b26c4ca683923b85a69f7ccdc0139e6acd1354cc884fe0128"}, + {file = "mypy-1.2.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:3efde4af6f2d3ccf58ae825495dbb8d74abd6d176ee686ce2ab19bd025273f41"}, + {file = "mypy-1.2.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:695c45cea7e8abb6f088a34a6034b1d273122e5530aeebb9c09626cea6dca4cb"}, + {file = "mypy-1.2.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d0e9464a0af6715852267bf29c9553e4555b61f5904a4fc538547a4d67617937"}, + {file = "mypy-1.2.0-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:8293a216e902ac12779eb7a08f2bc39ec6c878d7c6025aa59464e0c4c16f7eb9"}, + {file = "mypy-1.2.0-cp311-cp311-win_amd64.whl", hash = "sha256:f46af8d162f3d470d8ffc997aaf7a269996d205f9d746124a179d3abe05ac602"}, + {file = "mypy-1.2.0-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:031fc69c9a7e12bcc5660b74122ed84b3f1c505e762cc4296884096c6d8ee140"}, + {file = "mypy-1.2.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:390bc685ec209ada4e9d35068ac6988c60160b2b703072d2850457b62499e336"}, + {file = "mypy-1.2.0-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:4b41412df69ec06ab141808d12e0bf2823717b1c363bd77b4c0820feaa37249e"}, + {file = "mypy-1.2.0-cp37-cp37m-win_amd64.whl", hash = "sha256:4e4a682b3f2489d218751981639cffc4e281d548f9d517addfd5a2917ac78119"}, + {file = "mypy-1.2.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:a197ad3a774f8e74f21e428f0de7f60ad26a8d23437b69638aac2764d1e06a6a"}, + {file = "mypy-1.2.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:c9a084bce1061e55cdc0493a2ad890375af359c766b8ac311ac8120d3a472950"}, + {file = "mypy-1.2.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:eaeaa0888b7f3ccb7bcd40b50497ca30923dba14f385bde4af78fac713d6d6f6"}, + {file = "mypy-1.2.0-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:bea55fc25b96c53affab852ad94bf111a3083bc1d8b0c76a61dd101d8a388cf5"}, + {file = "mypy-1.2.0-cp38-cp38-win_amd64.whl", hash = "sha256:4c8d8c6b80aa4a1689f2a179d31d86ae1367ea4a12855cc13aa3ba24bb36b2d8"}, + {file = "mypy-1.2.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:70894c5345bea98321a2fe84df35f43ee7bb0feec117a71420c60459fc3e1eed"}, + {file = "mypy-1.2.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:4a99fe1768925e4a139aace8f3fb66db3576ee1c30b9c0f70f744ead7e329c9f"}, + {file = "mypy-1.2.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:023fe9e618182ca6317ae89833ba422c411469156b690fde6a315ad10695a521"}, + {file = "mypy-1.2.0-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:4d19f1a239d59f10fdc31263d48b7937c585810288376671eaf75380b074f238"}, + {file = "mypy-1.2.0-cp39-cp39-win_amd64.whl", hash = "sha256:2de7babe398cb7a85ac7f1fd5c42f396c215ab3eff731b4d761d68d0f6a80f48"}, + {file = "mypy-1.2.0-py3-none-any.whl", hash = "sha256:d8e9187bfcd5ffedbe87403195e1fc340189a68463903c39e2b63307c9fa0394"}, + {file = "mypy-1.2.0.tar.gz", hash = "sha256:f70a40410d774ae23fcb4afbbeca652905a04de7948eaf0b1789c8d1426b72d1"}, +] + +[package.dependencies] +mypy-extensions = ">=1.0.0" +tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""} +typing-extensions = ">=3.10" + +[package.extras] +dmypy = ["psutil (>=4.0)"] +install-types = ["pip"] +python2 = ["typed-ast (>=1.4.0,<2)"] +reports = ["lxml"] + [[package]] name = "mypy-extensions" version = "1.0.0" @@ -451,6 +553,21 @@ files = [ {file = "mypy_extensions-1.0.0.tar.gz", hash = "sha256:75dbf8955dc00442a438fc4d0666508a9a97b6bd41aa2f0ffe9d2f2725af0782"}, ] +[[package]] +name = "nodeenv" +version = "1.7.0" +description = "Node.js virtual environment builder" +category = "dev" +optional = false +python-versions = ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*" +files = [ + {file = "nodeenv-1.7.0-py2.py3-none-any.whl", hash = "sha256:27083a7b96a25f2f5e1d8cb4b6317ee8aeda3bdd121394e5ac54e498028a042e"}, + {file = "nodeenv-1.7.0.tar.gz", hash = "sha256:e0e7f7dfb85fc5394c6fe1e8fa98131a2473e04311a45afb6508f7cf1836fa2b"}, +] + +[package.dependencies] +setuptools = "*" + [[package]] name = "packaging" version = "23.1" @@ -550,6 +667,25 @@ files = [ dev = ["pre-commit", "tox"] testing = ["pytest", "pytest-benchmark"] +[[package]] +name = "pre-commit" +version = "3.2.2" +description = "A framework for managing and maintaining multi-language pre-commit hooks." +category = "dev" +optional = false +python-versions = ">=3.8" +files = [ + {file = "pre_commit-3.2.2-py2.py3-none-any.whl", hash = "sha256:0b4210aea813fe81144e87c5a291f09ea66f199f367fa1df41b55e1d26e1e2b4"}, + {file = "pre_commit-3.2.2.tar.gz", hash = "sha256:5b808fcbda4afbccf6d6633a56663fed35b6c2bc08096fd3d47ce197ac351d9d"}, +] + +[package.dependencies] +cfgv = ">=2.0.0" +identify = ">=1.0.0" +nodeenv = ">=0.11.1" +pyyaml = ">=5.1" +virtualenv = ">=20.10.0" + [[package]] name = "prompt-toolkit" version = "3.0.38" @@ -855,6 +991,23 @@ files = [ {file = "ruff-0.0.262.tar.gz", hash = "sha256:faea54231c265f5349975ba6f3d855b71881a01f391b2000c47740390c6d5f68"}, ] +[[package]] +name = "setuptools" +version = "67.7.2" +description = "Easily download, build, install, upgrade, and uninstall Python packages" +category = "dev" +optional = false +python-versions = ">=3.7" +files = [ + {file = "setuptools-67.7.2-py3-none-any.whl", hash = "sha256:23aaf86b85ca52ceb801d32703f12d77517b2556af839621c641fca11287952b"}, + {file = "setuptools-67.7.2.tar.gz", hash = "sha256:f104fa03692a2602fa0fec6c6a9e63b6c8a968de13e17c026957dd1f53d80990"}, +] + +[package.extras] +docs = ["furo", "jaraco.packaging (>=9)", "jaraco.tidelift (>=1.4)", "pygments-github-lexers (==0.0.5)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-favicon", "sphinx-hoverxref (<2)", "sphinx-inline-tabs", "sphinx-lint", "sphinx-notfound-page (==0.8.3)", "sphinx-reredirects", "sphinxcontrib-towncrier"] +testing = ["build[virtualenv]", "filelock (>=3.4.0)", "flake8 (<5)", "flake8-2020", "ini2toml[lite] (>=0.9)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "pip (>=19.1)", "pip-run (>=8.8)", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.3)", "pytest-flake8", "pytest-mypy (>=0.9.1)", "pytest-perf", "pytest-timeout", "pytest-xdist", "tomli-w (>=1.0.0)", "virtualenv (>=13.0.0)", "wheel"] +testing-integration = ["build[virtualenv]", "filelock (>=3.4.0)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "pytest", "pytest-enabler", "pytest-xdist", "tomli", "virtualenv (>=13.0.0)", "wheel"] + [[package]] name = "sgmllib3k" version = "1.0.0" @@ -947,6 +1100,18 @@ files = [ docs = ["myst-parser", "pydata-sphinx-theme", "sphinx"] test = ["argcomplete (>=2.0)", "pre-commit", "pytest", "pytest-mock"] +[[package]] +name = "types-python-dateutil" +version = "2.8.19.12" +description = "Typing stubs for python-dateutil" +category = "dev" +optional = false +python-versions = "*" +files = [ + {file = "types-python-dateutil-2.8.19.12.tar.gz", hash = "sha256:355b2cb82b31e556fd18e7b074de7c350c680ab80608f0cc55ba6770d986d67d"}, + {file = "types_python_dateutil-2.8.19.12-py3-none-any.whl", hash = "sha256:fe5b545e678ec13e3ddc83a0eee1545c1b5e2fba4cfc39b276ab6f4e7604a923"}, +] + [[package]] name = "types-pyyaml" version = "6.0.12.9" @@ -959,6 +1124,45 @@ files = [ {file = "types_PyYAML-6.0.12.9-py3-none-any.whl", hash = "sha256:5aed5aa66bd2d2e158f75dda22b059570ede988559f030cf294871d3b647e3e8"}, ] +[[package]] +name = "types-requests" +version = "2.29.0.0" +description = "Typing stubs for requests" +category = "dev" +optional = false +python-versions = "*" +files = [ + {file = "types-requests-2.29.0.0.tar.gz", hash = "sha256:c86f4a955d943d2457120dbe719df24ef0924e11177164d10a0373cf311d7b4d"}, + {file = "types_requests-2.29.0.0-py3-none-any.whl", hash = "sha256:4cf6e323e856c779fbe8815bb977a5bf5d6c5034713e4c17ff2a9a20610f5b27"}, +] + +[package.dependencies] +types-urllib3 = "<1.27" + +[[package]] +name = "types-tqdm" +version = "4.65.0.1" +description = "Typing stubs for tqdm" +category = "dev" +optional = false +python-versions = "*" +files = [ + {file = "types-tqdm-4.65.0.1.tar.gz", hash = "sha256:972dd871b6b2b8ff32f1f0f6fdfdf5a4ba2b0b848453689391bec8bd858fb1c4"}, + {file = "types_tqdm-4.65.0.1-py3-none-any.whl", hash = "sha256:4894fe2b1581374ce9bca3f23d53729e4409d69b352e3d5db5829fa19482962c"}, +] + +[[package]] +name = "types-urllib3" +version = "1.26.25.12" +description = "Typing stubs for urllib3" +category = "dev" +optional = false +python-versions = "*" +files = [ + {file = "types-urllib3-1.26.25.12.tar.gz", hash = "sha256:a1557355ce8d350a555d142589f3001903757d2d36c18a66f588d9659bbc917d"}, + {file = "types_urllib3-1.26.25.12-py3-none-any.whl", hash = "sha256:3ba3d3a8ee46e0d5512c6bd0594da4f10b2584b47a470f8422044a2ab462f1df"}, +] + [[package]] name = "typing-extensions" version = "4.5.0" @@ -988,6 +1192,27 @@ brotli = ["brotli (>=1.0.9)", "brotlicffi (>=0.8.0)", "brotlipy (>=0.6.0)"] secure = ["certifi", "cryptography (>=1.3.4)", "idna (>=2.0.0)", "ipaddress", "pyOpenSSL (>=0.14)", "urllib3-secure-extra"] socks = ["PySocks (>=1.5.6,!=1.5.7,<2.0)"] +[[package]] +name = "virtualenv" +version = "20.23.0" +description = "Virtual Python Environment builder" +category = "dev" +optional = false +python-versions = ">=3.7" +files = [ + {file = "virtualenv-20.23.0-py3-none-any.whl", hash = "sha256:6abec7670e5802a528357fdc75b26b9f57d5d92f29c5462ba0fbe45feacc685e"}, + {file = "virtualenv-20.23.0.tar.gz", hash = "sha256:a85caa554ced0c0afbd0d638e7e2d7b5f92d23478d05d17a76daeac8f279f924"}, +] + +[package.dependencies] +distlib = ">=0.3.6,<1" +filelock = ">=3.11,<4" +platformdirs = ">=3.2,<4" + +[package.extras] +docs = ["furo (>=2023.3.27)", "proselint (>=0.13)", "sphinx (>=6.1.3)", "sphinx-argparse (>=0.4)", "sphinxcontrib-towncrier (>=0.2.1a0)", "towncrier (>=22.12)"] +test = ["covdefaults (>=2.3)", "coverage (>=7.2.3)", "coverage-enable-subprocess (>=1)", "flaky (>=3.7)", "packaging (>=23.1)", "pytest (>=7.3.1)", "pytest-env (>=0.8.1)", "pytest-freezegun (>=0.4.2)", "pytest-mock (>=3.10)", "pytest-randomly (>=3.12)", "pytest-timeout (>=2.1)", "setuptools (>=67.7.1)", "time-machine (>=2.9)"] + [[package]] name = "wcwidth" version = "0.2.6" @@ -1003,4 +1228,4 @@ files = [ [metadata] lock-version = "2.0" python-versions = "^3.9" -content-hash = "33154f3c23919584547a91e2dc1196b77c664b4900c64d8a50af7d084d4cd4f7" +content-hash = "68ea2a125f98da42741e01d635f6c5a0650ff4e24ed839232e56787ef0fd184f" diff --git a/pyproject.toml b/pyproject.toml index 344fe7a..8649722 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,11 +38,16 @@ pydantic = "^1.10.7" platformdirs = "^3.4.0" pyyaml = "^6.0" - [tool.poetry.group.dev.dependencies] ruff = "^0.0.262" black = "^23.3.0" ipython = "^8.12.0" +mypy = "^1.2.0" +types-requests = "*" +types-python-dateutil = "*" +types-tqdm = "*" +types-PyYAML = "*" +pre-commit = "^3.2.2" [tool.poetry.group.tests.dependencies] pytest = "^7.3.1" @@ -88,6 +93,16 @@ omit = ["tests/*", "venv/*", ".venv/*"] [tool.coverage.report] precision = 1 +[tool.mypy] +warn_unused_configs = true +# disallow_untyped_defs = true +strict_optional = true +packages = ["podcast_archiver", "tests"] + +[[tool.mypy.overrides]] +module = "feedparser.*" +ignore_missing_imports = true + [build-system] requires = ["poetry-core>=1.0.0", "poetry-dynamic-versioning"] build-backend = "poetry_dynamic_versioning.backend" diff --git a/tests/test_happy_path.py b/tests/test_happy_path.py index 02ee3bf..a866e2f 100644 --- a/tests/test_happy_path.py +++ b/tests/test_happy_path.py @@ -5,7 +5,7 @@ def test_happy_path(tmp_path: Path, feed_lautsprecher): - settings = Settings(archive_directory=tmp_path, feeds=[feed_lautsprecher]) + settings = Settings(archive_directory=tmp_path, feeds=[feed_lautsprecher]) # type: ignore[call-arg] pa = PodcastArchiver(settings) pa.run() @@ -15,7 +15,11 @@ def test_happy_path(tmp_path: Path, feed_lautsprecher): def test_happy_path_max_episodes(tmp_path: Path, feed_lautsprecher): - settings = Settings(archive_directory=tmp_path, feeds=[feed_lautsprecher], maximum_episode_count=2) + settings = Settings( # type: ignore[call-arg] + archive_directory=tmp_path, + feeds=[feed_lautsprecher], + maximum_episode_count=2, + ) pa = PodcastArchiver(settings) pa.addFeed(feed_lautsprecher) @@ -27,7 +31,10 @@ def test_happy_path_max_episodes(tmp_path: Path, feed_lautsprecher): def test_happy_path_files_exist(tmp_path: Path, feed_lautsprecher): (tmp_path / "ls017-podcastverzeichnisse.m4a").touch() - settings = Settings(archive_directory=tmp_path, feeds=[feed_lautsprecher]) + settings = Settings( # type: ignore[call-arg] + archive_directory=tmp_path, + feeds=[feed_lautsprecher], + ) pa = PodcastArchiver(settings) pa.run() @@ -38,7 +45,11 @@ def test_happy_path_files_exist(tmp_path: Path, feed_lautsprecher): def test_happy_path_update(tmp_path: Path, feed_lautsprecher): (tmp_path / "ls017-podcastverzeichnisse.m4a").touch() - settings = Settings(archive_directory=tmp_path, feeds=[feed_lautsprecher], update_archive=True) + settings = Settings( # type: ignore[call-arg] + archive_directory=tmp_path, + feeds=[feed_lautsprecher], + update_archive=True, + ) pa = PodcastArchiver(settings) pa.run() @@ -50,7 +61,11 @@ def test_happy_path_update(tmp_path: Path, feed_lautsprecher): def test_happy_path_empty_feed(tmp_path: Path, feed_lautsprecher_empty): - settings = Settings(archive_directory=tmp_path, feeds=[feed_lautsprecher_empty], update_archive=True) + settings = Settings( # type: ignore[call-arg] + archive_directory=tmp_path, + feeds=[feed_lautsprecher_empty], + update_archive=True, + ) pa = PodcastArchiver(settings) pa.run() diff --git a/tests/test_main.py b/tests/test_main.py index eedd14a..4d1bbaa 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -8,7 +8,7 @@ def test_main(tmp_path_cd: Path, feed_lautsprecher): - main(("--feed", feed_lautsprecher)) + main(["--feed", feed_lautsprecher]) files = list(tmp_path_cd.glob("*.m4a")) assert len(files) == 5 @@ -16,7 +16,7 @@ def test_main(tmp_path_cd: Path, feed_lautsprecher): def test_main_interrupted(tmp_path_cd: Path, feed_lautsprecher_notconsumed): with patch("requests.sessions.Session.request", side_effect=KeyboardInterrupt), pytest.raises(SystemExit): - main(("--feed", feed_lautsprecher_notconsumed)) + main(["--feed", feed_lautsprecher_notconsumed]) files = list(tmp_path_cd.glob("*.m4a")) assert len(files) == 0