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

UserWarning in test_argparse #124245

Closed
serhiy-storchaka opened this issue Sep 19, 2024 · 0 comments
Closed

UserWarning in test_argparse #124245

serhiy-storchaka opened this issue Sep 19, 2024 · 0 comments
Labels
3.13 bugs and security fixes 3.14 new features, bugs and security fixes tests Tests in the Lib/test dir

Comments

@serhiy-storchaka
Copy link
Member

serhiy-storchaka commented Sep 19, 2024

Running test_argparse with option -We fails:

$ ./python -We -m test -vuall test_argparse -m test_invalid_args
...
======================================================================
ERROR: test_invalid_args (test.test_argparse.TestIntermixedArgs.test_invalid_args)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/serhiy/py/cpython/Lib/test/test_argparse.py", line 5815, in test_invalid_args
    parser.parse_intermixed_args(['hello', '--foo'])
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
  File "/home/serhiy/py/cpython/Lib/argparse.py", line 2386, in parse_intermixed_args
    args, argv = self.parse_known_intermixed_args(args, namespace)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/home/serhiy/py/cpython/Lib/argparse.py", line 2440, in parse_known_intermixed_args
    warn('Do not expect %s in %s' % (action.dest, namespace))
    ~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UserWarning: Do not expect foo in Namespace(foo=[])

----------------------------------------------------------------------

The test was added in gh-103558. cc @gaogaotiantian

Linked PRs

@serhiy-storchaka serhiy-storchaka added tests Tests in the Lib/test dir 3.13 bugs and security fixes 3.14 new features, bugs and security fixes labels Sep 19, 2024
serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this issue Sep 19, 2024
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Sep 19, 2024
(cherry picked from commit 992e8f6)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
@github-project-automation github-project-automation bot moved this to Doc issues in Argparse issues Sep 19, 2024
savannahostrowski pushed a commit to savannahostrowski/cpython that referenced this issue Sep 22, 2024
Yhg1s pushed a commit that referenced this issue Sep 30, 2024
gh-124245: Fix UserWarning in test_argparse (GH-124246)
(cherry picked from commit 992e8f6)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.13 bugs and security fixes 3.14 new features, bugs and security fixes tests Tests in the Lib/test dir
Projects
Status: Doc issues
Development

No branches or pull requests

1 participant