Skip to content

Commit

Permalink
tests: Fix for Python 3.13 (unittest.makeSuite was removed)
Browse files Browse the repository at this point in the history
```
ImportError while importing test module '…/pyftdi/pyftdi/tests/toolsimport.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
…/lib/python3.13/importlib/__init__.py:88: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
pyftdi/tests/toolsimport.py:16: in <module>
    from unittest import TestCase, TestSuite, makeSuite, main as ut_main
E   ImportError: cannot import name 'makeSuite' from 'unittest' (…/lib/python3.13/unittest/__init__.py)
```

python/cpython#104835
python/cpython#104836
python/cpython@b1cb30e
https://docs.python.org/3/whatsnew/3.13.html#unittest
  • Loading branch information
markmentovai committed Nov 4, 2024
1 parent 327a1a7 commit 426e1ab
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions pyftdi/tests/toolsimport.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from importlib import import_module
from os.path import dirname, join as joinpath
from sys import modules, path as syspath
from unittest import TestCase, TestSuite, makeSuite, main as ut_main
from unittest import TestCase, TestLoader, TestSuite, main as ut_main


class ToolsTestCase(TestCase):
Expand Down Expand Up @@ -57,7 +57,7 @@ def test_ftdi_urls(self):

def suite():
suite_ = TestSuite()
suite_.addTest(makeSuite(ToolsTestCase, 'test'))
suite_.addTest(TestLoader().loadTestsFromModule(modules[__name__]))
return suite_


Expand Down
5 changes: 2 additions & 3 deletions pyftdi/tests/uart.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from sys import modules, platform, stdout
from time import sleep, time as now
from threading import Thread
from unittest import TestCase, TestSuite, skipIf, makeSuite, main as ut_main
from unittest import TestCase, TestLoader, TestSuite, skipIf, main as ut_main
from pyftdi import FtdiLogger
from pyftdi.ftdi import Ftdi
from pyftdi.misc import to_bool
Expand Down Expand Up @@ -343,8 +343,7 @@ def test(self):

def suite():
suite_ = TestSuite()
suite_.addTest(makeSuite(BaudrateTestCase, 'test'))
suite_.addTest(makeSuite(UartTestCase, 'test'))
suite_.addTest(TestLoader().loadTestsFromModule(modules[__name__]))
return suite_


Expand Down

0 comments on commit 426e1ab

Please sign in to comment.