Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 3.13.0b1: test run fails, because: AttributeError: module 'unittest' has no attribute 'makeSuite' #1166

Closed
befeleme opened this issue May 15, 2024 · 3 comments

Comments

@befeleme
Copy link

When building PyTables for Fedora Linux with Python 3.13.0b1, we can't run the test suite.
'makeSuite' has been removed from Python 3.13, see: https://docs.python.org/dev/whatsnew/3.13.html#unittest

+ /usr/bin/python3 -m tables.tests.test_all -v
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
PyTables version:    3.9.2
HDF5 version:        1.12.1
NumPy version:       1.26.4
Numexpr version:     2.8.5 (not using Intel's VML/MKL)
Zlib version:        1.3.0.zlib-ng (in Python interpreter)
LZO version:         2.10 (Mar 01 2017)
BZIP2 version:       1.0.8 (13-Jul-2019)
Blosc version:       1.21.5 (2023-05-16)
Blosc compressors:   blosclz (2.5.1), lz4 (1.9.4), lz4hc (1.9.4), snappy (unknown), zlib (1.3.0.zlib-ng), zstd (1.5.5)
Blosc filters:       shuffle, bitshuffle
Blosc2 version:      2.14.4 (2023-04-10)
Blosc2 compressors:  blosclz (2.5.3), lz4 (1.9.4), lz4hc (1.9.4), zlib (2.1.6), zstd (1.5.6)
Blosc2 filters:      shuffle, bitshuffle
Cython version:      3.0.9
Python version:      3.13.0b1 (main, May  9 2024, 00:00:00) [GCC 14.1.1 20240507 (Red Hat 14.1.1-1)]
Platform:            Linux-6.6.13-200.fc39.x86_64-x86_64-with-glibc2.39.9000
Byte-ordering:       little
Detected cores:      2
Default encoding:    utf-8
Default FS encoding: utf-8
Default locale:      (C, UTF-8)
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/builddir/build/BUILDROOT/python-tables-3.9.2-5.fc41.x86_64/usr/lib64/python3.13/site-packages/tables/tests/test_all.py", line 49, in <module>
    common.unittest.main(defaultTest='tb.tests.suite')
    ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.13/unittest/main.py", line 103, in __init__
    self.parseArgs(argv)
    ~~~~~~~~~~~~~~^^^^^^
  File "/usr/lib64/python3.13/unittest/main.py", line 142, in parseArgs
    self.createTests()
    ~~~~~~~~~~~~~~~~^^
  File "/usr/lib64/python3.13/unittest/main.py", line 153, in createTests
    self.test = self.testLoader.loadTestsFromNames(self.testNames,
                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
                                                   self.module)
                                                   ^^^^^^^^^^^^
  File "/usr/lib64/python3.13/unittest/loader.py", line 207, in loadTestsFromNames
    suites = [self.loadTestsFromName(name, module) for name in names]
              ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
  File "/usr/lib64/python3.13/unittest/loader.py", line 192, in loadTestsFromName
    test = obj()
  File "/builddir/build/BUILDROOT/python-tables-3.9.2-5.fc41.x86_64/usr/lib64/python3.13/site-packages/tables/tests/test_suite.py", line 59, in suite
    alltests.addTest(test_suite())
                     ~~~~~~~~~~^^
Performing only a light (yet comprehensive) subset of the test suite.
If you want a more complete test, try passing the --heavy flag to this script
(or set the 'heavy' parameter in case you are using tables.test() call).
The whole suite will take more than 4 hours to complete on a relatively
modern CPU and around 512 MB of main memory.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  File "/builddir/build/BUILDROOT/python-tables-3.9.2-5.fc41.x86_64/usr/lib64/python3.13/site-packages/tables/tests/test_attributes.py", line 1858, in suite
    theSuite.addTest(common.unittest.makeSuite(NotCloseCreate))
                     ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.13/unittest/__init__.py", line 80, in __getattr__
    raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
AttributeError: module 'unittest' has no attribute 'makeSuite'
@avalentino
Copy link
Member

Thanks @befeleme for reporting.
I saw the announcement of the removal last week.
Unfortunately I'm traveling this week so I cannot address the issue, but is at the top of my TODO list for PyTables.

My understanding , by the way, is that we have still some time before Python v3.13.

In any case if you already have patch, or some preliminary code to share it would be more than welcome.

@jelly
Copy link

jelly commented May 15, 2024

The easiest approach is to instead use unittest.TestLoader().loadTestsFromTestCase

@avalentino avalentino self-assigned this May 19, 2024
@befeleme
Copy link
Author

befeleme commented Jun 3, 2024

There is one place where this doesn't work: prefix is not a recognized keyword argument:

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/builddir/build/BUILD/python-tables-3.9.2-build/BUILDROOT/usr/lib64/python3.13/site-packages/tables/tests/test_all.py", line 49, in <module>
    common.unittest.main(defaultTest='tb.tests.suite')
    ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.13/unittest/main.py", line 103, in __init__
    self.parseArgs(argv)
    ~~~~~~~~~~~~~~^^^^^^
  File "/usr/lib64/python3.13/unittest/main.py", line 142, in parseArgs
    self.createTests()
    ~~~~~~~~~~~~~~~~^^
  File "/usr/lib64/python3.13/unittest/main.py", line 153, in createTests
    self.test = self.testLoader.loadTestsFromNames(self.testNames,
                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
                                                   self.module)
                                                   ^^^^^^^^^^^^
Performing only a light (yet comprehensive) subset of the test suite.
If you want a more complete test, try passing the --heavy flag to this script
(or set the 'heavy' parameter in case you are using tables.test() call).
The whole suite will take more than 4 hours to complete on a relatively
modern CPU and around 512 MB of main memory.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  File "/usr/lib64/python3.13/unittest/loader.py", line 207, in loadTestsFromNames
    suites = [self.loadTestsFromName(name, module) for name in names]
              ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
  File "/usr/lib64/python3.13/unittest/loader.py", line 192, in loadTestsFromName
    test = obj()
  File "/builddir/build/BUILD/python-tables-3.9.2-build/BUILDROOT/usr/lib64/python3.13/site-packages/tables/tests/test_suite.py", line 59, in suite
    alltests.addTest(test_suite())
                     ~~~~~~~~~~^^
  File "/builddir/build/BUILD/python-tables-3.9.2-build/BUILDROOT/usr/lib64/python3.13/site-packages/tables/tests/test_queries.py", line 1246, in suite
    suite_ = common.make_suite(class_,
                                       prefix=autoprefix)
TypeError: make_suite() got an unexpected keyword argument 'prefix'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants