Skip to content

dev-python/plac: version bump 1.4.7; py3.15 compat - #1412

Open
mschubert wants to merge 1 commit into
gentoo:masterfrom
mschubert:plac
Open

mschubert wants to merge 1 commit into
gentoo:masterfrom
mschubert:plac

Conversation

@mschubert

Copy link
Copy Markdown
Contributor

No description provided.

@APN-Pucky APN-Pucky self-assigned this Nov 2, 2026
@APN-Pucky

Copy link
Copy Markdown
Member

I get:

[ERROR] >>> Not all runs were successful (1 failures in 2).
[ERROR] >>> atom: =dev-python/plac-1.4.7::science, USE flags: '-python_targets_python3_12 python_targets_python3_13 python_targets_python3_14 -python_targets_python3_15'

while

[INFO] >>> =dev-python/plac-1.4.7::science    USE: -python_targets_python3_12 python_targets_python3_13 -python_targets_python3_14 -python_targets_python3_15, FEATURES: test

worked.


========================================== FAILURES ===========================================
_____________________________________ test_expected_help ______________________________________

    def test_expected_help():
        for fname in os.listdir('.'):
            if fname.endswith('.help'):
                name = fname[:-5]
                if name not in ('vcs', 'ishelve'):
>                   check_help(fname[:-5])

fname      = 'example10.help'
name       = 'example10'

/var/tmp/portage/dev-python/plac-1.4.7/work/plac-1.4.7/doc/test_plac.py:109: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

name = 'example10'

    def check_help(name):
        sys.argv[0] = name + '.py'  # avoid issue with pytest
        plac_core._parser_registry.clear()  # makes different imports independent
    
        try:
            try:
                main = plac.import_main(name + '.py')
            except SyntaxError:
                if sys.version < '3':  # expected for Python 2.X
                    return
                else:  # not expected for Python 3.X
                    raise
            p = plac.parser_from(main, formatter_class=PlacTestFormatter)
    
            # Different format for Python > 3.13
            hname = name
            if version >= (3, 13):
                hname = dirname + '/' + hname
    
            #print (hname)
    
            with open(hname + '.help') as f:
                expected = fix_today(f.read()).strip()
    
            got = p.format_help().strip()
    
            #print (got)
    
            diff = list(difflib.unified_diff(expected.splitlines(),
                                             got.splitlines()))
            diff = '\n'.join(diff)
>           assert got == expected, diff
E           AssertionError: --- 
E             
E             +++ 
E             
E             @@ -1,4 +1,4 @@
E             
E             -usage: example10.py [-h] {add,mul} [n ...]
E             +usage: python3.14 -m pytest [-h] {add,mul} [n ...]
E              
E              A script to add and multiply numbers
E              
E           assert 'usage: python3.14 -m pytest [-h] {add,mul} [n ...]\n\nA script to add and multiply numbers\n\npositional arguments:\n  {add,mul}   The name of an operator\n  n           Zero or more numbers\n\noptions:\n  -h, --help  show this help message and exit' == 'usage: example10.py [-h] {add,mul} [n ...]\n\nA script to add and multiply numbers\n\npositional arguments:\n  {add,mul}   The name of an operator\n  n           Zero or more numbers\n\noptions:\n  -h, --help  show this help message and exit'
E             
E             - usage: example10.py [-h] {add,mul} [n ...]
E             + usage: python3.14 -m pytest [-h] {add,mul} [n ...]
E               
E               A script to add and multiply numbers
E               
E               positional arguments:
E                 {add,mul}   The name of an operator
E                 n           Zero or more numbers
E               
E               options:
E                 -h, --help  show this help message and exit

diff       = ('--- \n'
 '\n'
 '+++ \n'
 '\n'
 '@@ -1,4 +1,4 @@\n'
 '\n'
 '-usage: example10.py [-h] {add,mul} [n ...]\n'
 '+usage: python3.14 -m pytest [-h] {add,mul} [n ...]\n'
 ' \n'
 ' A script to add and multiply numbers\n'
 ' ')
expected   = ('usage: example10.py [-h] {add,mul} [n ...]\n'
 '\n'
 'A script to add and multiply numbers\n'
 '\n'
 'positional arguments:\n'
 '  {add,mul}   The name of an operator\n'
 '  n           Zero or more numbers\n'
 '\n'
 'options:\n'
 '  -h, --help  show this help message and exit')
f          = <_io.TextIOWrapper name='3.13/example10.help' mode='r' encoding='UTF-8'>
got        = ('usage: python3.14 -m pytest [-h] {add,mul} [n ...]\n'
 '\n'
 'A script to add and multiply numbers\n'
 '\n'
 'positional arguments:\n'
 '  {add,mul}   The name of an operator\n'
 '  n           Zero or more numbers\n'
 '\n'
 'options:\n'
 '  -h, --help  show this help message and exit')
hname      = '3.13/example10'
main       = <function main at 0x7fdb580dca90>
name       = 'example10'
p          = ArgumentParser(prog='python3.14 -m pytest', usage=None, description='A script to add and multiply numbers', formatter_class=<class 'test_plac.PlacTestFormatter'>, conflict_handler='error', add_help=True)

/var/tmp/portage/dev-python/plac-1.4.7/work/plac-1.4.7/doc/test_plac.py:97: AssertionError
__________________________________ test_metavar_no_defaults ___________________________________

    def test_metavar_no_defaults():
        sys.argv[0] = 'test_plac.py'
    
        # positional
        p = parser_from(lambda x: None,
                        x=('first argument', 'positional', None, str,
                           [], 'METAVAR'))
>       assert_usage(p, 'usage: test_plac.py [-h] METAVAR\n')

p          = ArgumentParser(prog='python3.14 -m pytest', usage=None, description=None, formatter_class=<class 'argparse.RawDescriptionHelpFormatter'>, conflict_handler='error', add_help=True)

/var/tmp/portage/dev-python/plac-1.4.7/work/plac-1.4.7/doc/test_plac.py:207: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

parser = ArgumentParser(prog='python3.14 -m pytest', usage=None, description=None, formatter_class=<class 'argparse.RawDescriptionHelpFormatter'>, conflict_handler='error', add_help=True)
expected = 'usage: test_plac.py [-h] METAVAR\n'

    def assert_usage(parser, expected):
        usage = parser.format_usage()
>       assert usage == expected, usage
E       AssertionError: usage: python3.14 -m pytest [-h] METAVAR
E         
E       assert 'usage: python3.14 -m pytest [-h] METAVAR\n' == 'usage: test_plac.py [-h] METAVAR\n'
E         
E         - usage: test_plac.py [-h] METAVAR
E         + usage: python3.14 -m pytest [-h] METAVAR

expected   = 'usage: test_plac.py [-h] METAVAR\n'
parser     = ArgumentParser(prog='python3.14 -m pytest', usage=None, description=None, formatter_class=<class 'argparse.RawDescriptionHelpFormatter'>, conflict_handler='error', add_help=True)
usage      = 'usage: python3.14 -m pytest [-h] METAVAR\n'

/var/tmp/portage/dev-python/plac-1.4.7/work/plac-1.4.7/doc/test_plac.py:197: AssertionError
_________________________________ test_metavar_with_defaults __________________________________

    def test_metavar_with_defaults():
        sys.argv[0] = 'test_plac.py'
    
        # positional
        p = parser_from(lambda x='a': None,
                        x=('first argument', 'positional', None, str,
                           [], 'METAVAR'))
>       assert_usage(p, 'usage: test_plac.py [-h] [METAVAR]\n')

p          = ArgumentParser(prog='python3.14 -m pytest', usage=None, description=None, formatter_class=<class 'argparse.RawDescriptionHelpFormatter'>, conflict_handler='error', add_help=True)

/var/tmp/portage/dev-python/plac-1.4.7/work/plac-1.4.7/doc/test_plac.py:223: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

parser = ArgumentParser(prog='python3.14 -m pytest', usage=None, description=None, formatter_class=<class 'argparse.RawDescriptionHelpFormatter'>, conflict_handler='error', add_help=True)
expected = 'usage: test_plac.py [-h] [METAVAR]\n'

    def assert_usage(parser, expected):
        usage = parser.format_usage()
>       assert usage == expected, usage
E       AssertionError: usage: python3.14 -m pytest [-h] [METAVAR]
E         
E       assert 'usage: python3.14 -m pytest [-h] [METAVAR]\n' == 'usage: test_plac.py [-h] [METAVAR]\n'
E         
E         - usage: test_plac.py [-h] [METAVAR]
E         + usage: python3.14 -m pytest [-h] [METAVAR]

expected   = 'usage: test_plac.py [-h] [METAVAR]\n'
parser     = ArgumentParser(prog='python3.14 -m pytest', usage=None, description=None, formatter_class=<class 'argparse.RawDescriptionHelpFormatter'>, conflict_handler='error', add_help=True)
usage      = 'usage: python3.14 -m pytest [-h] [METAVAR]\n'

/var/tmp/portage/dev-python/plac-1.4.7/work/plac-1.4.7/doc/test_plac.py:197: AssertionError
__________________________________ test_metavar_empty_string __________________________________

    def test_metavar_empty_string():
        # see https://github.com/ialbert/plac/issues/36
        def main(arg=''):
            pass
        sys.argv[0] = 'test_plac.py'
        p = parser_from(main)
>       assert_usage(p, "usage: test_plac.py [-h] ['']\n")

main       = <function test_metavar_empty_string.<locals>.main at 0x7fdb580de1f0>
p          = ArgumentParser(prog='python3.14 -m pytest', usage=None, description=None, formatter_class=<class 'argparse.RawDescriptionHelpFormatter'>, conflict_handler='error', add_help=True)

/var/tmp/portage/dev-python/plac-1.4.7/work/plac-1.4.7/doc/test_plac.py:244: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

parser = ArgumentParser(prog='python3.14 -m pytest', usage=None, description=None, formatter_class=<class 'argparse.RawDescriptionHelpFormatter'>, conflict_handler='error', add_help=True)
expected = "usage: test_plac.py [-h] ['']\n"

    def assert_usage(parser, expected):
        usage = parser.format_usage()
>       assert usage == expected, usage
E       AssertionError: usage: python3.14 -m pytest [-h] ['']
E         
E       assert "usage: python3.14 -m pytest [-h] ['']\n" == "usage: test_plac.py [-h] ['']\n"
E         
E         - usage: test_plac.py [-h] ['']
E         + usage: python3.14 -m pytest [-h] ['']

expected   = "usage: test_plac.py [-h] ['']\n"
parser     = ArgumentParser(prog='python3.14 -m pytest', usage=None, description=None, formatter_class=<class 'argparse.RawDescriptionHelpFormatter'>, conflict_handler='error', add_help=True)
usage      = "usage: python3.14 -m pytest [-h] ['']\n"

/var/tmp/portage/dev-python/plac-1.4.7/work/plac-1.4.7/doc/test_plac.py:197: AssertionError
- generated xml file: /var/tmp/portage/dev-python/plac-1.4.7/temp/pytest-xml/python3.14-8RzZvP.xml -
=================================== short test summary info ===================================
FAILED doc/test_plac.py::test_expected_help - AssertionError: --- 
FAILED doc/test_plac.py::test_metavar_no_defaults - AssertionError: usage: python3.14 -m pytest [-h] METAVAR
FAILED doc/test_plac.py::test_metavar_with_defaults - AssertionError: usage: python3.14 -m pytest [-h] [METAVAR]
FAILED doc/test_plac.py::test_metavar_empty_string - AssertionError: usage: python3.14 -m pytest [-h] ['']

I think the usage tests can be discarded here.

@mschubert

Copy link
Copy Markdown
Contributor Author

Tests all run fine on my end (py3.13-3.15), I just confirmed.

What is your exact py3.14 version? Could it be this? python/cpython#155009

Signed-off-by: Michael Schubert <mschu.dev@gmail.com>
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