Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: more typing and test improvements #890

Merged
merged 1 commit into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading