Skip to content

Commit

Permalink
chore: more typing and test improvements (#890)
Browse files Browse the repository at this point in the history
Signed-off-by: Henry Schreiner <[email protected]>
  • Loading branch information
henryiii authored Nov 13, 2024
1 parent bdd84a4 commit aabdc9b
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 11 deletions.
2 changes: 2 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,14 @@ repos:
files: ^nox/
args: []
additional_dependencies:
- argcomplete
- attrs
- colorlog
- dependency-groups>=1.2
- jinja2
- orjson # Faster mypy
- packaging
- pytest
- importlib_metadata
- importlib_resources
- tomli
Expand Down
6 changes: 3 additions & 3 deletions nox/_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ def _tag_completer(
noxfile=True,
merge_func=functools.partial(_sessions_merge_func, "keywords"),
help="Only run sessions that match the given expression.",
completer=argcomplete.completers.ChoicesCompleter(()),
completer=argcomplete.completers.ChoicesCompleter(()), # type: ignore[no-untyped-call]
),
_option_set.Option(
"tags",
Expand Down Expand Up @@ -499,7 +499,7 @@ def _tag_completer(
merge_func=_envdir_merge_func,
group=options.groups["environment"],
help="Directory where Nox will store virtualenvs, this is ``.nox`` by default.",
completer=argcomplete.completers.DirectoriesCompleter(),
completer=argcomplete.completers.DirectoriesCompleter(), # type: ignore[no-untyped-call]
),
_option_set.Option(
"extra_pythons",
Expand Down Expand Up @@ -577,7 +577,7 @@ def _tag_completer(
group=options.groups["reporting"],
noxfile=True,
help="Output a report of all sessions to the given filename.",
completer=argcomplete.completers.FilesCompleter(("json",)),
completer=argcomplete.completers.FilesCompleter(("json",)), # type: ignore[no-untyped-call]
),
_option_set.Option(
"non_interactive",
Expand Down
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ xfail_strict = true
filterwarnings = [ "error" ]
log_cli_level = "info"
testpaths = [ "tests" ]
pythonpath = [ ".github/" ]

[tool.coverage]
run.branch = true
Expand All @@ -132,7 +133,8 @@ python_version = "3.8"
strict = true
warn_unreachable = true
enable_error_code = [ "ignore-without-code", "redundant-expr", "truthy-bool" ]
mypy_path = [ ".github" ]

[[tool.mypy.overrides]]
module = [ "argcomplete", "colorlog.*", "py", "tox.*" ]
module = [ "tox.*" ]
ignore_missing_imports = true
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@


@pytest.fixture(autouse=True)
def reset_color_envvars(monkeypatch):
def reset_color_envvars(monkeypatch: pytest.MonkeyPatch) -> None:
"""Remove color-related envvars to fix test output"""
monkeypatch.delenv("FORCE_COLOR", raising=False)
monkeypatch.delenv("NO_COLOR", raising=False)
Expand Down
7 changes: 1 addition & 6 deletions tests/test_action_helper.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
from __future__ import annotations

import json
import sys
from pathlib import Path

import pytest

GITHUB_FOLDER = Path(__file__).resolve().parent.parent / ".github"
sys.path.insert(0, str(GITHUB_FOLDER))
from action_helper import filter_version, setup_action # noqa: E402
from action_helper import filter_version, setup_action

VALID_VERSIONS = {
"2.7.18": "2.7",
Expand Down

0 comments on commit aabdc9b

Please sign in to comment.