Skip to content

Commit ad1e717

Browse files
authored
Merge branch 'master' into _cmd_property
2 parents 87a3e5d + c4a8d0e commit ad1e717

File tree

9 files changed

+26
-63
lines changed

9 files changed

+26
-63
lines changed

.github/workflows/build.yml

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,36 @@
22
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions
33
name: "build"
44

5-
on: [ push, pull_request ]
5+
on: [push, pull_request]
66

77
jobs:
88
build:
99
strategy:
1010
fail-fast: false
1111
matrix:
12-
os: [ ubuntu-latest, macos-latest, windows-latest ]
13-
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12", "3.13" ]
12+
os: [ubuntu-latest, macos-latest, windows-latest]
13+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
1414
runs-on: ${{ matrix.os }}
1515
steps:
16-
- uses: actions/checkout@v4 # https://github.com/actions/checkout
16+
- uses: actions/checkout@v4 # https://github.com/actions/checkout
1717
with:
1818
# Only a single commit is fetched by default, for the ref/SHA that triggered the workflow.
1919
# Set fetch-depth: 0 to fetch all history for all branches and tags.
2020
fetch-depth: 0 # Needed for setuptools_scm to work correctly
21-
- uses: actions/setup-python@v5 # https://github.com/actions/setup-python
21+
- name: Install uv
22+
uses: astral-sh/setup-uv@v3
23+
24+
- name: Set up Python ${{ matrix.python-version }}
25+
uses: actions/setup-python@v5
2226
with:
2327
python-version: ${{ matrix.python-version }}
2428
allow-prereleases: true
25-
- name: Install dependencies
26-
run: python -m pip install --upgrade pip setuptools setuptools-scm nox
27-
- name: Run tests and post coverage results
28-
env:
29-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30-
run: python -m nox --non-interactive --session tests-${{ matrix.python-version }} # Run nox for a single version of Python
29+
30+
- name: Install the project
31+
run: uv sync --all-extras --dev
32+
33+
- name: Run tests
34+
run: uv run inv pytest --junit --no-pty --base
35+
36+
- name: Run isolated tests
37+
run: uv run inv pytest --junit --no-pty --isolated

cmd2/cmd2.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3404,8 +3404,7 @@ def _cmdloop(self) -> None:
34043404
alias_description = "Manage aliases\n" "\n" "An alias is a command that enables replacement of a word by another string."
34053405
alias_epilog = "See also:\n" " macro"
34063406
alias_parser = argparse_custom.DEFAULT_ARGUMENT_PARSER(description=alias_description, epilog=alias_epilog)
3407-
alias_subparsers = alias_parser.add_subparsers(dest='subcommand', metavar='SUBCOMMAND')
3408-
alias_subparsers.required = True
3407+
alias_parser.add_subparsers(dest='subcommand', metavar='SUBCOMMAND', required=True)
34093408

34103409
# Preserve quotes since we are passing strings to other commands
34113410
@with_argparser(alias_parser, preserve_quotes=True)
@@ -3573,8 +3572,7 @@ def _alias_list(self, args: argparse.Namespace) -> None:
35733572
macro_description = "Manage macros\n" "\n" "A macro is similar to an alias, but it can contain argument placeholders."
35743573
macro_epilog = "See also:\n" " alias"
35753574
macro_parser = argparse_custom.DEFAULT_ARGUMENT_PARSER(description=macro_description, epilog=macro_epilog)
3576-
macro_subparsers = macro_parser.add_subparsers(dest='subcommand', metavar='SUBCOMMAND')
3577-
macro_subparsers.required = True
3575+
macro_parser.add_subparsers(dest='subcommand', metavar='SUBCOMMAND', required=True)
35783576

35793577
# Preserve quotes since we are passing strings to other commands
35803578
@with_argparser(macro_parser, preserve_quotes=True)

noxfile.py

Lines changed: 0 additions & 25 deletions
This file was deleted.

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ dev = [
5252
"doc8",
5353
"invoke",
5454
"mypy",
55-
"nox",
5655
"pytest",
5756
"pytest-cov",
5857
"pytest-mock",

tasks.py

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def rmrf(items, verbose=True):
4949

5050
#####
5151
#
52-
# pytest, nox, pylint, and codecov
52+
# pytest, pylint, and codecov
5353
#
5454
#####
5555

@@ -117,17 +117,6 @@ def mypy_clean(context):
117117
namespace_clean.add_task(mypy_clean, 'mypy')
118118

119119

120-
@invoke.task
121-
def nox_clean(context):
122-
"""Remove nox virtualenvs and logs"""
123-
# pylint: disable=unused-argument
124-
with context.cd(TASK_ROOT_STR):
125-
rmrf('.nox')
126-
127-
128-
namespace_clean.add_task(nox_clean, 'nox')
129-
130-
131120
#####
132121
#
133122
# documentation

tests/test_argparse.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -250,8 +250,7 @@ def test_preservelist(argparse_app):
250250

251251
def _build_has_subcmd_parser() -> cmd2.Cmd2ArgumentParser:
252252
has_subcmds_parser = cmd2.Cmd2ArgumentParser(description="Tests as_subcmd_to decorator")
253-
has_subcmds_subparsers = has_subcmds_parser.add_subparsers(dest='subcommand', metavar='SUBCOMMAND')
254-
has_subcmds_subparsers.required = True
253+
has_subcmds_parser.add_subparsers(dest='subcommand', metavar='SUBCOMMAND', required=True)
255254
return has_subcmds_parser
256255

257256

@@ -273,8 +272,7 @@ def base_helpless(self, args):
273272

274273
# create the top-level parser for the base command
275274
base_parser = cmd2.Cmd2ArgumentParser()
276-
base_subparsers = base_parser.add_subparsers(dest='subcommand', metavar='SUBCOMMAND')
277-
base_subparsers.required = True
275+
base_subparsers = base_parser.add_subparsers(dest='subcommand', metavar='SUBCOMMAND', required=True)
278276

279277
# create the parser for the "foo" subcommand
280278
parser_foo = base_subparsers.add_parser('foo', help='foo help')

tests/test_argparse_completer.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1249,8 +1249,7 @@ def do_custom_completer(self, args: argparse.Namespace) -> None:
12491249

12501250
# Test as_subcommand_to decorator with custom completer
12511251
top_parser = Cmd2ArgumentParser(description="Top Command")
1252-
top_subparsers = top_parser.add_subparsers(dest='subcommand', metavar='SUBCOMMAND')
1253-
top_subparsers.required = True
1252+
top_parser.add_subparsers(dest='subcommand', metavar='SUBCOMMAND', required=True)
12541253

12551254
@with_argparser(top_parser)
12561255
def do_top(self, args: argparse.Namespace) -> None:

tests_isolated/test_commandset/test_argparse_subcommands.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ def base_helpless(self, args):
3535

3636
# create the top-level parser for the base command
3737
base_parser = cmd2.Cmd2ArgumentParser()
38-
base_subparsers = base_parser.add_subparsers(dest='subcommand', metavar='SUBCOMMAND')
39-
base_subparsers.required = True
38+
base_subparsers = base_parser.add_subparsers(dest='subcommand', metavar='SUBCOMMAND', required=True)
4039

4140
# create the parser for the "foo" subcommand
4241
parser_foo = base_subparsers.add_parser('foo', help='foo help')

tests_isolated/test_commandset/test_commandset.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,7 @@ def do_elderberry(self, ns: argparse.Namespace):
9393
# Test that CommandSet with as_subcommand_to decorator successfully loads
9494
# during `cmd2.Cmd.__init__()`.
9595
main_parser = cmd2.Cmd2ArgumentParser(description="Main Command")
96-
main_subparsers = main_parser.add_subparsers(dest='subcommand', metavar='SUBCOMMAND')
97-
main_subparsers.required = True
96+
main_parser.add_subparsers(dest='subcommand', metavar='SUBCOMMAND', required=True)
9897

9998
@cmd2.with_category('Alone')
10099
@cmd2.with_argparser(main_parser)

0 commit comments

Comments
 (0)