Skip to content

fix: checks type for nested subparsers - #338

Merged
gaborbernat merged 3 commits into
tox-dev:mainfrom
jduf:main
Aug 11, 2026
Merged

fix: checks type for nested subparsers#338
gaborbernat merged 3 commits into
tox-dev:mainfrom
jduf:main

Conversation

@jduf

@jduf jduf commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

this fails:

def get_parser_2() -> ArgumentParser:
    parser = ArgumentParser(prog="prog")

    sub_parser = parser.add_subparsers(dest="command")
    command = sub_parser.add_parser("parent")
    command.add_argument("key")

    sub_sub_parser = command.add_subparsers(dest="subcommand")
    subcommand = sub_sub_parser.add_parser("child")
    subcommand.add_argument("--b", action="store_true")

    return parser

@gaborbernat gaborbernat left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs test.

@jduf

jduf commented Aug 10, 2026

Copy link
Copy Markdown
Contributor Author

I would be happy to try to fix my PR but I don't know how to run the tests on my machine...

@gaborbernat

Copy link
Copy Markdown
Member

I would be happy to try to fix my PR but I don't know how to run the tests on my machine...

We're using tox, read https://tox.wiki/en/4.58.0/.

@jduf

jduf commented Aug 10, 2026

Copy link
Copy Markdown
Contributor Author

Okay, I added one test function and a related test directory in root. I hope what I did respects your requirements. It's the first time I create a PR and work with tox... I hope my PR is helpful!

@gaborbernat
gaborbernat merged commit 41a0606 into tox-dev:main Aug 11, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants