Bug 1915256 - freeipa-healthcheck fails to build with Python 3.10: Result.__init__() repr has changed
Summary: freeipa-healthcheck fails to build with Python 3.10: Result.__init__() repr h...
Keywords:
Status: POST
Alias: None
Product: Fedora
Classification: Fedora
Component: freeipa-healthcheck
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: François Cami
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3.10
TreeView+ depends on / blocked
 
Reported: 2021-01-12 10:59 UTC by Tomáš Hrnčiar
Modified: 2021-02-09 16:24 UTC (History)
9 users (show)

Fixed In Version: freeipa-healthcheck-0.8-1.fc34
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-01-13 20:14:01 UTC
Type: Bug


Attachments (Terms of Use)

Description Tomáš Hrnčiar 2021-01-12 10:59:28 UTC
freeipa-healthcheck fails to build with Python 3.10.0a4.

tests/test_ipa_dns.py FEFEFEFEFEFEFEFEFE                                 [ 33%]

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.10/fedora-rawhide-x86_64/01875840-freeipa-healthcheck/

For all our attempts to build freeipa-healthcheck with Python 3.10, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.10/package/freeipa-healthcheck/

Testing and mass rebuild of packages is happening in copr. You can follow these instructions to test locally in mock if your package builds with Python 3.10:
https://copr.fedorainfracloud.org/coprs/g/python/python3.10/

Let us know here if you have any questions.

Python 3.10 will be included in Fedora 35. To make that update smoother, we're building Fedora packages with early pre-releases of Python 3.10.
A build failure prevents us from testing all dependent packages (transitive [Build]Requires), so if this package is required a lot, it's important for us to get it fixed soon.
We'd appreciate help from the people who know this package best, but if you don't want to work on this now, let us know so we can try to work around it on our side.

Comment 1 Miro Hrončok 2021-01-12 11:06:46 UTC
Many errors are:

    def no_exceptions(results):
        """Given Results ensure that an except was not raised"""
>       for result in results.results:
E       AttributeError: 'NoneType' object has no attribute 'results'

And:


E           AttributeError: <module 'ipaserver.dns_data_management' from '/usr/lib/python3.10/site-packages/ipaserver/dns_data_management.py'> does not have the attribute 'resolve_rrsets'

One is:

E       assert "Result.__ini... and 'result'" == "__init__() m... and 'result'"
E         - __init__() missing 2 required positional arguments: 'plugin' and 'result'
E         + Result.__init__() missing 2 required positional arguments: 'plugin' and 'result'
E         ? +++++++

Comment 2 Christian Heimes 2021-01-12 11:16:24 UTC
Tests are failing because https://pagure.io/freeipa/issue/8529 removed import of resolve_rrsets

________________ TestDNSSystemRecords.test_dnsrecords_bad_realm ________________
/usr/lib64/python3.10/unittest/mock.py:1348: in patched
    with self.decoration_helper(patched,
/usr/lib64/python3.10/contextlib.py:133: in __enter__
    return next(self.gen)
/usr/lib64/python3.10/unittest/mock.py:1330: in decoration_helper
    arg = exit_stack.enter_context(patching)
/usr/lib64/python3.10/contextlib.py:478: in enter_context
    result = _cm_type.__enter__(cm)
/usr/lib64/python3.10/unittest/mock.py:1419: in __enter__
    original, local = self.get_original()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <unittest.mock._patch object at 0x7f47ce41ecd0>
    def get_original(self):
        target = self.getter()
        name = self.attribute
    
        original = DEFAULT
        local = False
    
        try:
            original = target.__dict__[name]
        except (AttributeError, KeyError):
            original = getattr(target, name, DEFAULT)
        else:
            local = True
    
        if name in _builtins and isinstance(target, ModuleType):
            self.create = True
    
        if not self.create and original is DEFAULT:
>           raise AttributeError(
                "%s does not have the attribute %r" % (target, name)
            )
E           AttributeError: <module 'ipaserver.dns_data_management' from '/usr/lib/python3.10/site-packages/ipaserver/dns_data_management.py'> does not have the attribute 'resolve_rrsets'
/usr/lib64/python3.10/unittest/mock.py:1392: AttributeError

Comment 3 Rob Crittenden 2021-01-12 15:02:06 UTC
The resolve_rrsets issue should already be handled by https://github.com/freeipa/freeipa-healthcheck/commit/30d97eff4b932001a1c1771cc64743752115ea6f which is in freeipa-healthcheck-0.7 in rawhide.

I'll take a look.

Comment 4 Rob Crittenden 2021-01-12 16:09:44 UTC
I've reproduced additional failures in rawhide using python 3.9 that I need to get through first.

It looks related to data new validations added to python3-dns-2.1.0-1. The test is doing the absolute minimum to fake a DNS response and that is no longer sufficient for python3-dns.

Comment 5 Rob Crittenden 2021-01-12 18:40:11 UTC
The 0.7 tarball doesn't match the upstream 0.7 tag by two commits. The resolve_rrsets change is one of them :/

I'm not sure how this happened or what I want to do about it.

Comment 6 Rob Crittenden 2021-01-12 20:16:13 UTC
I'm going to do another upstream release to fix the missing commit issue in addition to PR https://github.com/freeipa/freeipa-healthcheck/pull/177 which will fix test execution with python3-dns-2.1.0.

Comment 7 Tomáš Hrnčiar 2021-01-14 07:06:27 UTC
Hello, 

thank you for the fix. Sadly, there is still one more test failing.
For complete log see: https://download.copr.fedorainfracloud.org/results/@python/python3.10/fedora-rawhide-x86_64/01879241-freeipa-healthcheck/builder-live.log.gz

=================================== FAILURES ===================================
_________________________________ test_Result __________________________________

    def test_Result():
        """
        Test the `ipahealthcheck.plugin.Result` class
        """
    
        registry = Registry()
        p = Plugin(registry)
    
        # Standard case of passing plugin to Result
        r = Result(p, constants.SUCCESS)
    
        kw = dict(key='value')
        r = Result(p, constants.SUCCESS, **kw)
    
        e = raises(TypeError, Result)
>       assert str(e) == "__init__() missing 2 required positional arguments: " \
                         "'plugin' and 'result'"
E       assert "Result.__ini... and 'result'" == "__init__() m... and 'result'"
E         - __init__() missing 2 required positional arguments: 'plugin' and 'result'
E         + Result.__init__() missing 2 required positional arguments: 'plugin' and 'result'
E         ? +++++++

tests/test_results.py:25: AssertionError
=========================== short test summary info ============================
FAILED tests/test_results.py::test_Result - assert "Result.__ini... and 'resu...
======================== 1 failed, 120 passed in 1.93s =========================

Comment 8 Rob Crittenden 2021-01-14 18:48:04 UTC
Ok I see the problem. Looks like python 3.10 is adding the class name to the exception. I have a fix, do you need a build or is pushing the patch to distgit sufficient?

Comment 9 Miro Hrončok 2021-01-14 19:43:58 UTC
Pushing the patch to distgit is sufficient.

If you open a PR, the copr repo will attempt to build it in https://copr.fedorainfracloud.org/coprs/g/python/python3.10/builds/?dirname=python3.10:pr:<pr_number>

Comment 10 Rob Crittenden 2021-01-14 20:54:50 UTC
I'm not sure how to do that against copr. I created a PR against the healthcheck dist-git, maybe you can cherry-pick that?

https://src.fedoraproject.org/rpms/freeipa-healthcheck/pull-request/3

Comment 11 Miro Hrončok 2021-01-14 21:06:33 UTC
That's it, your build is in https://copr.fedorainfracloud.org/coprs/g/python/python3.10/builds/?dirname=python3.10:pr:3 and it is a success.
When you merge the PR, it will be built in the copr's main directory.

Comment 12 Ben Cotton 2021-02-09 15:39:54 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 34 development cycle.
Changing version to 34.


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