Bug 1809970 - python-openstacksdk fails to build in Fedora 32+: AttributeError: 'TestComponentManager' object has no attribute 'assertItemsEqual'
Summary: python-openstacksdk fails to build in Fedora 32+: AttributeError: 'TestCompon...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: python-openstacksdk
Version: 32
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Javier Peña
QA Contact: Fedora Extras Quality Assurance
URL: https://koschei.fedoraproject.org/pac...
Whiteboard:
Depends On:
Blocks: F32FTBFS PYTHON39 F33FTBFS 1794222
TreeView+ depends on / blocked
 
Reported: 2020-03-04 10:23 UTC by Miro Hrončok
Modified: 2020-03-16 20:33 UTC (History)
2 users (show)

Fixed In Version: python-openstacksdk-0.36.0-4.fc32
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-03-16 20:33:49 UTC
Type: Bug


Attachments (Terms of Use)

Description Miro Hrončok 2020-03-04 10:23:03 UTC
Description of problem:
Package python-openstacksdk fails to build from source in Fedora 32 and rawhide:

Traceback (most recent call last):
  File "/usr/bin/stestr-3", line 10, in <module>
    sys.exit(main())
  File "/usr/lib/python3.8/site-packages/stestr/cli.py", line 118, in main
    return cli.run(argv)
  File "/usr/lib/python3.8/site-packages/cliff/app.py", line 281, in run
    result = self.run_subcommand(remainder)
  File "/usr/lib/python3.8/site-packages/cliff/app.py", line 401, in run_subcommand
    result = cmd.run(parsed_args)
  File "/usr/lib/python3.8/site-packages/cliff/command.py", line 185, in run
    return_code = self.take_action(parsed_args) or 0
  File "/usr/lib/python3.8/site-packages/stestr/commands/run.py", line 231, in take_action
    result = run_command(
  File "/usr/lib/python3.8/site-packages/stestr/commands/run.py", line 533, in run_command
    return _run_tests(cmd, until_failure,
  File "/usr/lib/python3.8/site-packages/stestr/commands/run.py", line 609, in _run_tests
    return run_tests()
  File "/usr/lib/python3.8/site-packages/stestr/commands/run.py", line 599, in run_tests
    return load.load((None, None), in_streams=run_procs,
  File "/usr/lib/python3.8/site-packages/stestr/commands/load.py", line 243, in load
    retval = _load_case(inserter, repo, case, subunit_out, pretty_out,
  File "/usr/lib/python3.8/site-packages/stestr/commands/load.py", line 278, in _load_case
    case.run(result)
  File "/usr/lib/python3.8/site-packages/testtools/testsuite.py", line 169, in run
    result.status(**event_dict)
  File "/usr/lib/python3.8/site-packages/testtools/testresult/real.py", line 468, in status
    _strict_map(methodcaller('status', *args, **kwargs), self.targets)
  File "/usr/lib/python3.8/site-packages/testtools/testresult/real.py", line 443, in _strict_map
    return list(map(function, *sequences))
  File "/usr/lib/python3.8/site-packages/testtools/testresult/real.py", line 570, in status
    target.status(**kwargs)
  File "/usr/lib/python3.8/site-packages/testtools/testresult/real.py", line 468, in status
    _strict_map(methodcaller('status', *args, **kwargs), self.targets)
  File "/usr/lib/python3.8/site-packages/testtools/testresult/real.py", line 443, in _strict_map
    return list(map(function, *sequences))
  File "/usr/lib/python3.8/site-packages/testtools/testresult/real.py", line 909, in status
    self._hook.status(*args, **kwargs)
  File "/usr/lib/python3.8/site-packages/testtools/testresult/real.py", line 826, in status
    self.on_test(self._inprogress.pop(key))
  File "/usr/lib/python3.8/site-packages/testtools/testresult/real.py", line 901, in _handle_test
    self.on_test(test_record.to_dict())
  File "/usr/lib/python3.8/site-packages/stestr/subunit_trace.py", line 192, in show_outcome
    print_attachments(stream, test, all_channels=True)
  File "/usr/lib/python3.8/site-packages/stestr/subunit_trace.py", line 120, in print_attachments
    if (all_channels or name in channels) and detail.as_text():
  File "/usr/lib/python3.8/site-packages/testtools/content.py", line 91, in as_text
    return _u('').join(self.iter_text())
  File "/usr/lib/python3.8/site-packages/testtools/content.py", line 107, in iter_text
    raise ValueError("Not a text type %r" % self.content_type)
ValueError: Not a text type application/octet-stream

Version-Release number of selected component (if applicable):
0.36.0-3.fc32

Steps to Reproduce:
fedpkg build

Additional info:
This package is tracked by Koschei. See:
https://koschei.fedoraproject.org/package/python-openstacksdk

This blocks the Python 3.9 rebuild.

Comment 1 Javier Peña 2020-03-04 11:39:19 UTC
Hm, looking at the stack trace, it looks like we have an issue in either stestr or testtools. Do we have similar issues in other packages using them?

Comment 2 Miro Hrončok 2020-03-04 11:52:30 UTC
I haven't seen this error elsewhere yet.

Comment 3 Javier Peña 2020-03-04 13:46:49 UTC
Trying a scratch build, I'm getting a different error during unit tests:

    AttributeError: 'TestComponentManager' object has no attribute 'assertItemsEqual'

There are several instances of this, all pointing to the absence of assertItemsEqual in a test object.

I think this was related to a Python 3.9 deprecation, and it should be replaced with assertCountEqual, is this correct (I haven't been able to find the exact Python bug where it is removed for 3.9)? If so, we will need an upstream patch.

Comment 4 Miro Hrončok 2020-03-04 14:32:22 UTC
Ok, that's getting us somewhere.

> AttributeError: 'TestComponentManager' object has no attribute 'assertItemsEqual'

This should be 'assertCountEqual' on Python 3.

This is related to unittest2 vs unittest.

See also:

python-osc-lib: bz1809967
python-openstackclient: bz1809969
python-tackerclient: bz1809986

Comment 5 Javier Peña 2020-03-04 15:21:59 UTC
It's taken me a while, but I think I've finally been able to track down the whole issue.

So, as you mentioned, it is related to unittest2 vs unitttest. I see that [1] added a Fedora-only patch to remove unittest2 support from python3-testtools, which ultimately triggered the issue. Also, upstream testtools seems to be going to remove unittest2 support [2], so this is coming anyway.

I have proposed a patch to openstacksdk [3] explaining the situation. If it goes well, we should follow-up with patches for the rest of the projects. However, I wonder if we should start patching all packages in the meantime, or we could revert [1] until it is done in upstream testtools. If we can't revert it, I would propose to disable %check in the affected packages until the upstream projects include the fixes.

[1] - https://src.fedoraproject.org/rpms/python-testtools/c/a9f35e790da9df7278d56e497ece180d8366118a?branch=master
[2] - https://github.com/testing-cabal/testtools/issues/286
[3] - https://review.opendev.org/711235

Comment 6 Miro Hrončok 2020-03-04 15:35:46 UTC
Under normal circumstances I would agree that we should revert [1], however a maintainer pulled the trigger prematurely on one of the unittest2 deps and hence unittest2 no longer installs - the revert chain is very long here and I rather do a handful of "patches forward" than a handful of "patches backwards". The issues here might be solvable by a dirty hotfix sed in %preps.

That said, if you disagree, you can unretire python-traceback2.

Comment 7 Javier Peña 2020-03-04 16:24:22 UTC
Fair enough. My patch to openstacksdk has been accepted, and I see it applies cleanly, so I've added it to the spec.

https://koji.fedoraproject.org/koji/taskinfo?taskID=42186298 includes it, and builds without issues.

Should I backport it to the f32 branch as well?

Comment 8 Miro Hrončok 2020-03-04 23:19:53 UTC
Thank you!

> Should I backport it to the f32 branch as well?

As long as you need to be able to build it (I'd assume yes).

Comment 9 Fedora Update System 2020-03-05 08:38:16 UTC
FEDORA-2020-47920f69fd has been submitted as an update to Fedora 32. https://bodhi.fedoraproject.org/updates/FEDORA-2020-47920f69fd

Comment 10 Fedora Update System 2020-03-05 19:36:28 UTC
python-openstacksdk-0.36.0-4.fc32 has been pushed to the Fedora 32 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-47920f69fd

Comment 11 Fedora Update System 2020-03-16 20:33:49 UTC
python-openstacksdk-0.36.0-4.fc32 has been pushed to the Fedora 32 stable repository. If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.