clan-cli: enable mypy for tests
This commit is contained in:
@@ -17,9 +17,6 @@ warn_redundant_casts = true
|
|||||||
disallow_untyped_calls = true
|
disallow_untyped_calls = true
|
||||||
disallow_untyped_defs = true
|
disallow_untyped_defs = true
|
||||||
no_implicit_optional = true
|
no_implicit_optional = true
|
||||||
exclude = [
|
|
||||||
"tests"
|
|
||||||
]
|
|
||||||
|
|
||||||
[[tool.mypy.overrides]]
|
[[tool.mypy.overrides]]
|
||||||
module = "setuptools.*"
|
module = "setuptools.*"
|
||||||
|
|||||||
@@ -1,16 +1,20 @@
|
|||||||
import argparse
|
import argparse
|
||||||
|
from typing import Union
|
||||||
|
|
||||||
|
import pytest_subprocess.fake_process
|
||||||
|
from pytest_subprocess import utils
|
||||||
|
|
||||||
from clan_cli import admin
|
from clan_cli import admin
|
||||||
|
|
||||||
|
|
||||||
def test_make_parser():
|
def test_make_parser() -> None:
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
admin.register_parser(parser)
|
admin.register_parser(parser)
|
||||||
|
|
||||||
|
|
||||||
# using fp fixture from pytest-subprocess
|
# using fp fixture from pytest-subprocess
|
||||||
def test_create(fp):
|
def test_create(fp: pytest_subprocess.fake_process.FakeProcess) -> None:
|
||||||
cmd = ["nix", "flake", "init", "-t", fp.any()]
|
cmd: list[Union[str, utils.Any]] = ["nix", "flake", "init", "-t", fp.any()]
|
||||||
fp.register(cmd)
|
fp.register(cmd)
|
||||||
args = argparse.Namespace(folder="./my-clan")
|
args = argparse.Namespace(folder="./my-clan")
|
||||||
admin.create(args)
|
admin.create(args)
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ def test_no_args(capsys):
|
|||||||
assert captured.out.startswith("usage:")
|
assert captured.out.startswith("usage:")
|
||||||
|
|
||||||
|
|
||||||
def test_help(capsys, monkeypatch):
|
def test_help(capsys: pytest.CaptureFixture, monkeypatch: pytest.MonkeyPatch) -> None:
|
||||||
monkeypatch.setattr(sys, "argv", ["", "--help"])
|
monkeypatch.setattr(sys, "argv", ["", "--help"])
|
||||||
with pytest.raises(SystemExit):
|
with pytest.raises(SystemExit):
|
||||||
clan_cli.main()
|
clan_cli.main()
|
||||||
|
|||||||
@@ -20,9 +20,6 @@ warn_redundant_casts = true
|
|||||||
disallow_untyped_calls = true
|
disallow_untyped_calls = true
|
||||||
disallow_untyped_defs = true
|
disallow_untyped_defs = true
|
||||||
no_implicit_optional = true
|
no_implicit_optional = true
|
||||||
exclude = [
|
|
||||||
"tests"
|
|
||||||
]
|
|
||||||
|
|
||||||
[[tool.mypy.overrides]]
|
[[tool.mypy.overrides]]
|
||||||
module = "setuptools.*"
|
module = "setuptools.*"
|
||||||
|
|||||||
Reference in New Issue
Block a user