| Summary: | dev-python/argh-0.26.2-r2 fails tests | ||
|---|---|---|---|
| Product: | Gentoo Linux | Reporter: | Paolo Pedroni <paolo.pedroni> |
| Component: | Current packages | Assignee: | Python Gentoo Team <python> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | jstein |
| Priority: | Normal | Keywords: | TESTFAILURE |
| Version: | unspecified | ||
| Hardware: | All | ||
| OS: | Linux | ||
| See Also: | https://github.com/neithere/argh/issues/148 | ||
| Whiteboard: | |||
| Package list: | Runtime testing required: | --- | |
| Bug Depends on: | 827860 | ||
| Bug Blocks: | 796119 | ||
| Attachments: | argh-0.26.2-r2:20211115-164858.log.gz | ||
|
Description
Paolo Pedroni
2021-11-15 16:51:19 UTC
Happens also on hppa I have 4 of them on sparc:
____________________________ test_add_subparsers_when_default_command_exists__supported _____________________________
@pytest.mark.skipif(sys.version_info < (3,4), reason='supported since Python 3.4')
def test_add_subparsers_when_default_command_exists__supported():
def one(): return 1
def two(): return 2
p = argh.ArghParser()
p.set_default_command(one)
p.add_commands([two])
ns_one = p.parse_args([])
ns_two = p.parse_args(['two'])
assert ns_one.get_function() == one
> assert ns_two.get_function() == two
E assert <function test_add_subparsers_when_default_command_exists__supported.<locals>.one at 0xf5c66cd0> == <function test_add_subparsers_when_default_command_exists__supported.<locals>.two at 0xf5c66d60>
E +<function test_add_subparsers_when_default_command_exists__supported.<locals>.one at 0xf5c66cd0>
E -<function test_add_subparsers_when_default_command_exists__supported.<locals>.two at 0xf5c66d60>
ns_one = ArghNamespace(_functions_stack=[<function test_add_subparsers_when_default_command_exists__supported.<locals>.one at 0xf5c66cd0>])
ns_two = ArghNamespace(_functions_stack=[<function test_add_subparsers_when_default_command_exists__supported.<locals>.two at 0xf5c66d60>, <function test_add_subparsers_when_default_command_exists__supported.<locals>.one at 0xf5c66cd0>])
one = <function test_add_subparsers_when_default_command_exists__supported.<locals>.one at 0xf5c66cd0>
p = ArghParser(prog='__main__.py', usage=None, description=None, formatter_class=<class 'argh.constants.CustomFormatter'>, conflict_handler='error', add_help=True)
two = <function test_add_subparsers_when_default_command_exists__supported.<locals>.two at 0xf5c66d60>
test/test_assembling.py:136: AssertionError
_____________________________ test_set_default_command_when_subparsers_exist__supported _____________________________
____________________________ test_add_subparsers_when_default_command_exists__supported _____________________________
@pytest.mark.skipif(sys.version_info < (3,4), reason='supported since Python 3.4')
def test_set_default_command_when_subparsers_exist__supported():
def one(): return 1
def two(): return 2
p = argh.ArghParser()
p.add_commands([one])
p.set_default_command(two)
ns_two = p.parse_args([])
ns_one = p.parse_args(['one'])
> assert ns_one.get_function() == one
E assert <function test_set_default_command_when_subparsers_exist__supported.<locals>.two at 0xf5ca8b68> == <function test_set_default_command_when_subparsers_exist__supported.<locals>.one at 0xf5ca8b20>
E +<function test_set_default_command_when_subparsers_exist__supported.<locals>.two at 0xf5ca8b68>
E -<function test_set_default_command_when_subparsers_exist__supported.<locals>.one at 0xf5ca8b20>
ns_one = ArghNamespace(_functions_stack=[<function test_set_default_command_when_subparsers_exist__supported.<locals>.one at 0xf5ca8b20>, <function test_set_default_command_when_subparsers_exist__supported.<locals>.two at 0xf5ca8b68>])
ns_two = ArghNamespace(_functions_stack=[<function test_set_default_command_when_subparsers_exist__supported.<locals>.two at 0xf5ca8b68>])
one = <function test_set_default_command_when_subparsers_exist__supported.<locals>.one at 0xf5ca8b20>
p = ArghParser(prog='__main__.py', usage=None, description=None, formatter_class=<class 'argh.constants.CustomFormatter'>, conflict_handler='error', add_help=True)
two = <function test_set_default_command_when_subparsers_exist__supported.<locals>.two at 0xf5ca8b68>
test/test_assembling.py:151: AssertionError
________________________________________________ test_invalid_choice ________________________________________________
def test_invalid_choice():
def cmd(args):
return 1
# root level command
p = DebugArghParser()
p.add_commands([cmd])
> assert run(p, 'bar', exit=True).startswith('invalid choice')
E assert False
E + where False = <built-in method startswith of str object at 0xf5e72338>('invalid choice')
E + where <built-in method startswith of str object at 0xf5e72338> = "argument {cmd}: invalid choice: 'bar' (choose from 'cmd')".startswith
E + where "argument {cmd}: invalid choice: 'bar' (choose from 'cmd')" = run(DebugArghParser(prog='__main__.py', usage=None, description=None, formatter_class=<class 'argh.constants.CustomFormatter'>, conflict_handler='error', add_help=True), 'bar', exit=True)
cmd = <function test_invalid_choice.<locals>.cmd at 0xf5c8d220>
p = DebugArghParser(prog='__main__.py', usage=None, description=None, formatter_class=<class 'argh.constants.CustomFormatter'>, conflict_handler='error', add_help=True)
test/test_integration.py:380: AssertionError
______________________________________________ test_explicit_cmd_name _______________________________________________
def test_explicit_cmd_name():
@argh.named('new-name')
def orig_name():
return 'ok'
p = DebugArghParser()
p.add_commands([orig_name])
> assert run(p, 'orig-name', exit=True).startswith('invalid choice')
E assert False
E + where False = <built-in method startswith of str object at 0xf5cad910>('invalid choice')
E + where <built-in method startswith of str object at 0xf5cad910> = "argument {new-name}: invalid choice: 'orig-name' (choose from 'new-name')".startswith
E + where "argument {new-name}: invalid choice: 'orig-name' (choose from 'new-name')" = run(DebugArghParser(prog='__main__.py', usage=None, description=None, formatter_class=<class 'argh.constants.CustomFormatter'>, conflict_handler='error', add_help=True), 'orig-name', exit=True)
orig_name = <function test_explicit_cmd_name.<locals>.orig_name at 0xf5ca8da8>
p = DebugArghParser(prog='__main__.py', usage=None, description=None, formatter_class=<class 'argh.constants.CustomFormatter'>, conflict_handler='error', add_help=True)
No, on the other machine: I have seen it on _hppa_, not sparc. The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6f194f12a2e30aad7da347848f7b0187e188f983 commit 6f194f12a2e30aad7da347848f7b0187e188f983 Author: Arthur Zamarin <arthurzam@gentoo.org> AuthorDate: 2021-12-01 17:44:23 +0000 Commit: Arthur Zamarin <arthurzam@gentoo.org> CommitDate: 2021-12-01 17:47:04 +0000 dev-python/argh: partial tests fix Fix two of 4 tests failures. Other two happen only on python-3.9.8 and not any later version, so will auto fix itself with time. See bug for more info. Bug: https://bugs.gentoo.org/823832 Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org> dev-python/argh/argh-0.26.2-r2.ebuild | 6 ++++- .../argh/files/argh-0.26.2-fix-py3.9-msgs.patch | 31 ++++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) OK, found the issue upstream (see [0], especially last two comments). We have here two classes of errors: 1. the two reported by Paolo: wrote a patch and will fix it now. 2. the extra two found by Rolf [1] happens only on python3.9 (not on 3.8 or 3.10) and only for 3.9.8 from this change [2] which was reverted [3] for python-3.9.9. I prefer to wait for stabilization of 3.9.9 and removal of 3.9.8 to fix this issue second group. Meanwhile, you can skip those two failures [0] https://github.com/neithere/argh/issues/148 [1] test_set_default_command_when_subparsers_exist__supported ,test_add_subparsers_when_default_command_exists__supported [2] https://github.com/python/cpython/commit/a18d52269ab6071a605d6c72f6af585a4c533ca4 [3] https://github.com/python/cpython/commit/587ff7f50bcbfd8346c6d5db459a1628a350c04d Closing as python-3.9.9 is stabilized and 3.9.8 was cleaned. Thank you all for the help and investigation. |