Skip to content

Commit

Permalink
fix: changelog and update test list
Browse files Browse the repository at this point in the history
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
  • Loading branch information
henryiii committed Nov 20, 2024
1 parent 4da7fcd commit cad03c9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
3 changes: 3 additions & 0 deletions docs/changelog/3446.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Add a ``schema`` command to produce a JSON Schema for tox and the current plugins.

- by :user:`henryiii`
3 changes: 1 addition & 2 deletions src/tox/session/cmd/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import sys
import typing
from pathlib import Path
from types import NoneType
from typing import TYPE_CHECKING

import packaging.requirements
Expand Down Expand Up @@ -39,7 +38,7 @@ def _process_type(of_type: typing.Any) -> dict[str, typing.Any]: # noqa: C901,
}:
return {"type": "string"}
if typing.get_origin(of_type) is typing.Union:
types = [x for x in typing.get_args(of_type) if x is not NoneType]
types = [x for x in typing.get_args(of_type) if x is not type(None)]
if len(types) == 1:
return _process_type(types[0])
msg = f"Union types are not supported: {of_type}"
Expand Down
2 changes: 2 additions & 0 deletions tests/config/cli/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from tox.session.cmd.run.parallel import run_parallel
from tox.session.cmd.run.sequential import run_sequential
from tox.session.cmd.show_config import show_config
from tox.session.cmd.schema import gen_schema

if TYPE_CHECKING:
from tox.session.state import State
Expand All @@ -23,6 +24,7 @@ def core_handlers() -> dict[str, Callable[[State], int]]:
return {
"config": show_config,
"c": show_config,
"schema": gen_schema,
"list": list_env,
"l": list_env,
"run": run_sequential,
Expand Down

0 comments on commit cad03c9

Please sign in to comment.