Bug 2165551 - beaker fails to build with Python 3.12: AttributeError: 'JobSchemaTest' object has no attribute 'assert_'. Did you mean: 'assertIn'
Summary: beaker fails to build with Python 3.12: AttributeError: 'JobSchemaTest' objec...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: beaker
Version: 38
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Martin Styk
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3.12
TreeView+ depends on / blocked
 
Reported: 2023-01-30 12:21 UTC by Tomáš Hrnčiar
Modified: 2023-07-27 10:50 UTC (History)
5 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2023-07-27 10:50:22 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Tomáš Hrnčiar 2023-01-30 12:21:27 UTC
beaker fails to build with Python 3.12.0a4.

=================================== FAILURES ===================================
________________________ JobSchemaTest.test_disk_units _________________________

self = <bkr.common.test_schema.JobSchemaTest testMethod=test_disk_units>

    def test_disk_units(self):
        # These are all valid units for disk sizes:
        units = ['bytes', 'B', 'kB', 'KB', 'KiB', 'MB', 'MiB',
                 'GB', 'GiB', 'TB', 'TiB']
        for unit in units:
            self.assert_valid('''
                <job>
                    <recipeSet>
                        <recipe>
                            <distroRequires/>
                            <hostRequires>
                                <disk>
                                    <size op="&gt;=" value="10" units="%s" />
                                </disk>
                            </hostRequires>
                            <task name="/distribution/install" />
                        </recipe>
                    </recipeSet>
                </job>
                ''' % unit)
        # gigaquads are definitely not a valid unit for disk sizes
>       self.assert_not_valid('''
            <job>
                <recipeSet>
                    <recipe>
                        <distroRequires/>
                        <hostRequires>
                            <disk>
                                <size op="&gt;=" value="10" units="gigaquads" />
                            </disk>
                        </hostRequires>
                        <task name="/distribution/install" />
                    </recipe>
                </recipeSet>
            </job>
            ''',
            'Element hostRequires has extra content: disk')

bkr/common/test_schema.py:408: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <bkr.common.test_schema.JobSchemaTest testMethod=test_disk_units>
xml = '\n            <job>\n                <recipeSet>\n                    <recipe>\n                        <distroRequir...istribution/install" />\n                    </recipe>\n                </recipeSet>\n            </job>\n            '
error_message = 'Element hostRequires has extra content: disk'

    def assert_not_valid(self, xml, error_message):
        schema = lxml.etree.RelaxNG(self.schema_doc)
>       self.assert_(not schema.validate(lxml.etree.fromstring(xml)))
E       AttributeError: 'JobSchemaTest' object has no attribute 'assert_'. Did you mean: 'assertIn'?

bkr/common/test_schema.py:21: AttributeError
____________________ JobSchemaTest.test_duplicate_elements _____________________

self = <bkr.common.test_schema.JobSchemaTest testMethod=test_duplicate_elements>

    def test_duplicate_elements(self):
>       self.assert_not_valid('''
            <job>
                <recipeSet>
                    <recipe kernel_options="" kernel_options_post="" ks_meta="" role="None" whiteboard="">
                        <autopick random="true"/>
                        <autopick random="false"/>
                        <watchdog panic="None"/>
                        <watchdog panic="always"/>
                        <packages/>
                        <packages/>
                        <ks_appends/>
                        <ks_appends/>
                        <repos/>
                        <repos/>
                        <distroRequires/>
                        <hostRequires/>
                        <task name="/distribution/install" role="STANDALONE"/>
                    </recipe>
                </recipeSet>
            </job>
            ''',
            'Extra element autopick in interleave')

bkr/common/test_schema.py:189: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <bkr.common.test_schema.JobSchemaTest testMethod=test_duplicate_elements>
xml = '\n            <job>\n                <recipeSet>\n                    <recipe kernel_options="" kernel_options_post="...ll" role="STANDALONE"/>\n                    </recipe>\n                </recipeSet>\n            </job>\n            '
error_message = 'Extra element autopick in interleave'

    def assert_not_valid(self, xml, error_message):
        schema = lxml.etree.RelaxNG(self.schema_doc)
>       self.assert_(not schema.validate(lxml.etree.fromstring(xml)))
E       AttributeError: 'JobSchemaTest' object has no attribute 'assert_'. Did you mean: 'assertIn'?

bkr/common/test_schema.py:21: AttributeError
_______________________ JobSchemaTest.test_force_system ________________________

self = <bkr.common.test_schema.JobSchemaTest testMethod=test_force_system>

    def test_force_system(self):
    
        # force and hostRequires are mutually exclusive
>       self.assert_not_valid('''
            <job>
                <recipeSet>
                    <recipe>
                        <distroRequires>
                            <distro_name op="=" value="BlueShoeLinux5-5"/>
                        </distroRequires>
                        <task name="/distribution/install" role="STANDALONE"/>
                        <hostRequires force="test1.system.fqdn">
                        <system> <name op="=" value="test1.system.fqdn"/> </system>
                        </hostRequires>
    
                    </recipe>
                </recipeSet>
            </job>
            ''', 'Invalid attribute force for element hostRequires')

bkr/common/test_schema.py:275: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <bkr.common.test_schema.JobSchemaTest testMethod=test_force_system>
xml = '\n            <job>\n                <recipeSet>\n                    <recipe>\n                        <distroRequir...      </hostRequires>\n\n                    </recipe>\n                </recipeSet>\n            </job>\n            '
error_message = 'Invalid attribute force for element hostRequires'

    def assert_not_valid(self, xml, error_message):
        schema = lxml.etree.RelaxNG(self.schema_doc)
>       self.assert_(not schema.validate(lxml.etree.fromstring(xml)))
E       AttributeError: 'JobSchemaTest' object has no attribute 'assert_'. Did you mean: 'assertIn'?

bkr/common/test_schema.py:21: AttributeError
_________________ JobSchemaTest.test_hostRequires_not_optional _________________

self = <bkr.common.test_schema.JobSchemaTest testMethod=test_hostRequires_not_optional>

    def test_hostRequires_not_optional(self):
>       self.assert_not_valid('''
            <job>
                <recipeSet>
                    <recipe>
                        <distroRequires>
                            <distro_name op="=" value="BlueShoeLinux5-5"/>
                        </distroRequires>
                        <task name="/distribution/install" role="STANDALONE"/>
                    </recipe>
                </recipeSet>
            </job>
            ''',
            'Invalid sequence in interleave')

bkr/common/test_schema.py:257: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <bkr.common.test_schema.JobSchemaTest testMethod=test_hostRequires_not_optional>
xml = '\n            <job>\n                <recipeSet>\n                    <recipe>\n                        <distroRequir...ll" role="STANDALONE"/>\n                    </recipe>\n                </recipeSet>\n            </job>\n            '
error_message = 'Invalid sequence in interleave'

    def assert_not_valid(self, xml, error_message):
        schema = lxml.etree.RelaxNG(self.schema_doc)
>       self.assert_(not schema.validate(lxml.etree.fromstring(xml)))
E       AttributeError: 'JobSchemaTest' object has no attribute 'assert_'. Did you mean: 'assertIn'?

bkr/common/test_schema.py:21: AttributeError
______ JobSchemaTest.test_minimal_job_with_invalid_system_inventory_date _______

self = <bkr.common.test_schema.JobSchemaTest testMethod=test_minimal_job_with_invalid_system_inventory_date>

    def test_minimal_job_with_invalid_system_inventory_date(self):
>       self.assert_not_valid('''
            <job>
                <recipeSet>
                    <recipe>
                        <distroRequires>
                            <distro_name op="=" value="BlueShoeLinux5-5"/>
                        </distroRequires>
                        <hostRequires>
                            <system>
                              <last_inventoried op="=" value="2013-10-10 10:10:10" />
                            </system>
                        </hostRequires>
                        <task name="/distribution/install" role="STANDALONE"/>
                    </recipe>
                </recipeSet>
            </job>
        ''', 'Element hostRequires has extra content: system')

bkr/common/test_schema.py:146: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <bkr.common.test_schema.JobSchemaTest testMethod=test_minimal_job_with_invalid_system_inventory_date>
xml = '\n            <job>\n                <recipeSet>\n                    <recipe>\n                        <distroRequir...nstall" role="STANDALONE"/>\n                    </recipe>\n                </recipeSet>\n            </job>\n        '
error_message = 'Element hostRequires has extra content: system'

    def assert_not_valid(self, xml, error_message):
        schema = lxml.etree.RelaxNG(self.schema_doc)
>       self.assert_(not schema.validate(lxml.etree.fromstring(xml)))
E       AttributeError: 'JobSchemaTest' object has no attribute 'assert_'. Did you mean: 'assertIn'?

bkr/common/test_schema.py:21: AttributeError
=========================== short test summary info ============================
FAILED bkr/common/test_schema.py::JobSchemaTest::test_disk_units - AttributeE...
FAILED bkr/common/test_schema.py::JobSchemaTest::test_duplicate_elements - At...
FAILED bkr/common/test_schema.py::JobSchemaTest::test_force_system - Attribut...
FAILED bkr/common/test_schema.py::JobSchemaTest::test_hostRequires_not_optional
FAILED bkr/common/test_schema.py::JobSchemaTest::test_minimal_job_with_invalid_system_inventory_date
========================= 5 failed, 19 passed in 0.27s =========================

Removed many old deprecated unittest features:

    - A number of TestCase method aliases:

    | Deprecated alias      |  Method Name           | Deprecated in |
    +-----------------------|------------------------|---------------+
    | failUnless            | assertTrue()           |      3.1      |
    | failIf                | assertFalse()          |      3.1      |
    | failUnlessEqual       | assertEqual()          |      3.1      |
    | failIfEqual           | assertNotEqual()       |      3.1      |
    | failUnlessAlmostEqual | assertAlmostEqual()    |      3.1      |
    | failIfAlmostEqual     | assertNotAlmostEqual() |      3.1      |
    | failUnlessRaises      | assertRaises()         |      3.1      |
    | assert_               | assertTrue()           |      3.2      |
    | assertEquals          | assertEqual()          |      3.2      |
    | assertNotEquals       | assertNotEqual()       |      3.2      |
    | assertAlmostEquals    | assertAlmostEqual()    |      3.2      |
    | assertNotAlmostEquals | assertNotAlmostEqual() |      3.2      |
    | assertRegexpMatches   | assertRegex()          |      3.2      |
    | assertRaisesRegexp    | assertRaisesRegex()    |      3.2      |
    | assertNotRegexpMatches| assertNotRegex()       |      3.5      |
    +-----------------------|------------------------|---------------+

    You can use https://github.com/isidentical/teyit to automatically modernise your unit tests.

    - Undocumented and broken TestCase method assertDictContainsSubset (deprecated in Python 3.2).

    - Undocumented TestLoader.loadTestsFromModule parameter use_load_tests (deprecated and ignored since Python 3.2).

    - An alias of the TextTestResult class: _TextTestResult (deprecated in Python
3.2).

(Contributed by Serhiy Storchaka in bpo-45162.)
https://bugs.python.org/issue?@action=redirect&bpo=45162



https://docs.python.org/3.12/whatsnew/3.12.html

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.12/fedora-rawhide-x86_64/05250877-beaker/

For all our attempts to build beaker with Python 3.12, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.12/package/beaker/

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.12:
https://copr.fedorainfracloud.org/coprs/g/python/python3.12/

Let us know here if you have any questions.

Python 3.12 is planned to be included in Fedora 39. To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.12.
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 Ben Cotton 2023-02-07 15:07:06 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 38 development cycle.
Changing version to 38.

Comment 2 Martin Styk 2023-07-27 10:50:22 UTC
I fixed the build failure by disabling tests. This is just a dirty hack to enable building.
I will create a new upstream issue to fix this problem.


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