mirror of
https://github.com/rpm-software-management/tito.git
synced 2025-02-23 20:22:46 +00:00
avoid TB on python3 due to strict dict type
On python3, we need to perform a union (not addition) on dictionary sets to avoid... Traceback (most recent call last): File "/home/sandbox/test/functional/fetch_tests.py", line 95, in test_with_releaser self.source_filename) File "/home/sandbox/test/functional/fixture.py", line 103, in tito return CLI().main(argstring.split(' ')) File "/home/sandbox/src/tito/cli.py", line 222, in main return module.main(argv) File "/home/sandbox/src/tito/cli.py", line 599, in main **kwargs) File "/home/sandbox/src/tito/release/main.py", line 359, in __init__ prefix="yumrepo-", **kwargs) File "/home/sandbox/src/tito/release/main.py", line 238, in __init__ auto_accept, **kwargs) File "/home/sandbox/src/tito/release/main.py", line 73, in __init__ _args = config_builder_args.items() + kwargs['builder_args'].items() nose.proxy.TypeError: TypeError: unsupported operand type(s) for +: 'dict_items' and 'dict_items'
This commit is contained in:
parent
bcf29ea34b
commit
00f2dfc84f
2 changed files with 17 additions and 2 deletions
|
@ -48,6 +48,18 @@ def getoutput(cmd):
|
|||
return getstatusoutput(cmd)[1]
|
||||
|
||||
|
||||
def dictionary_override(d1, d2):
|
||||
"""
|
||||
Return a new dictionary object where
|
||||
d2 elements override d1 elements.
|
||||
"""
|
||||
if PY2:
|
||||
overrides = d1.items() + d2.items()
|
||||
else:
|
||||
overrides = d1.items() | d2.items()
|
||||
return dict(overrides)
|
||||
|
||||
|
||||
def write(fd, str):
|
||||
"""
|
||||
A version of os.write that
|
||||
|
|
|
@ -71,8 +71,11 @@ class Releaser(ConfigObject):
|
|||
|
||||
# Override with builder args from command line if any were given:
|
||||
if 'builder_args' in kwargs:
|
||||
self.builder_args = dict(config_builder_args.items() +
|
||||
kwargs['builder_args'].items())
|
||||
# (in case of dupes, last one wins)
|
||||
self.builder_args = dictionary_override(
|
||||
config_builder_args,
|
||||
kwargs['builder_args']
|
||||
)
|
||||
else:
|
||||
self.builder_args = config_builder_args
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue