#1058031 pygame: FTBFS with Python 3.12

Package:
src:pygame
Source:
src:pygame
Submitter:
Graham Inggs
Date:
2024-08-17 11:51:03 UTC
Severity:
normal
Tags:
#1058031#5
Date:
2023-12-11 12:28:58 UTC
From:
To:
Hi Maintainer

pygame FTBFS [1] with Python 3.12 as a supported version.  I've copied
what I hope is the relevant part of the log below.

Regards
Graham


[1] https://buildd.debian.org/status/package.php?p=pygame


loading pygame.tests.transform_test
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/<<PKGBUILDDIR>>/.pybuild/cpython3_3.12_pygame/build/pygame/tests/__main__.py",
line 143, in <module>
    run_and_exit(*args, **kwds)
  File "/<<PKGBUILDDIR>>/.pybuild/cpython3_3.12_pygame/build/pygame/tests/test_utils/run_tests.py",
line 346, in run_and_exit
    total, fails = run(*args, **kwargs)
                   ^^^^^^^^^^^^^^^^^^^^
  File "/<<PKGBUILDDIR>>/.pybuild/cpython3_3.12_pygame/build/pygame/tests/test_utils/run_tests.py",
line 303, in run
    raise AssertionError(
AssertionError: Something went wrong in the Test Machinery:
total: 1807 != untrusty_total: 1840

#1058031#16
Date:
2024-01-10 15:14:03 UTC
From:
To:
Dear Maintainer,

AssertionError comes from comparing '...' occurrences in
test result output with the number of ran tests.
I've added this code:

    with open('/tmp/debian-tmp', 'a') as f:
        import pprint, copy
        tmp_results = copy.deepcopy(results)
        for k, v in tmp_results.items():
            v['output'] = v['output'].split('\n')
        pprint.pprint(tmp_results, f, indent=2)

at line 292 in test/test_utils/run_tests.py [1]; two dicts and the diff
between Python 3.11 and 3.12 are attached. (Please note different values
for 'num_tests' keys).

Something has been changed in python 3.12 at presenting test results
when there are skipped tests:

(test.py)

import unittest

class FooTest(unittest.TestCase):
    @unittest.skip
    def test_foo(self):
        self.assertTrue(True)

    def test_bar(self):
        self.assertFalse(False)

if __name__ == '__main__':
    unittest.main()


$ python3.11 test.py
.s
----------------------------------------------------------------------
Ran 2 tests in 0.000s

OK (skipped=1)


$ python3.12 test.py
.s
----------------------------------------------------------------------
Ran 1 test in 0.000s

OK (skipped=1)


I don't know if this change is intended or it's a bug (I wasn't
able to find references in python 3.12 changelog).

Kind Regards

[1] https://sources.debian.org/src/pygame/2.5.2-1.1/test/test_utils/run_tests.py/#L292

#1058031#21
Date:
2024-01-11 09:09:37 UTC
From:
To:
lowering the severity, ignoring the problem for now. The package is now
built for 3.12.