diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index 746b259..ace5f57 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -27,4 +27,4 @@ jobs: python setup.py develop - name: Run Tests run: | - python setup.py test + python -m unittest discover -s tests -p "*.py" diff --git a/.gitignore b/.gitignore index 0dad1ea..9eeece8 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ __pycache__/ # Distribution / packaging .Python env/ +venv/ build/ develop-eggs/ dist/ diff --git a/README.md b/README.md index ea04ba9..9f68b32 100644 --- a/README.md +++ b/README.md @@ -116,7 +116,7 @@ python setup.py develop ### Test ```bash -python setup.py test +python -m unittest discover -s tests -p "*.py" ``` ## Maintainers diff --git a/requirements-dev.txt b/requirements-dev.txt index c03eb43..b347bbd 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,3 +1,3 @@ -Cython==0.29.33 -Sphinx==2.2.1 -sphinx-rtd-theme==0.4.3 +Cython==3.0.11 +Sphinx==8.1.1 +sphinx-rtd-theme==3.0.1 diff --git a/setup.py b/setup.py index 094d47d..04e7700 100644 --- a/setup.py +++ b/setup.py @@ -65,7 +65,6 @@ long_description=long_description, long_description_content_type="text/markdown", license="MIT License", - test_suite="tests.test_all", ext_modules=ext_modules, python_requires=">=3.5, <4", classifiers=[ diff --git a/tests/__init__.py b/tests/__init__.py index e8919aa..56a8862 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1,7 +1,4 @@ import os -import glob -import unittest -import importlib import functools import tempfile @@ -17,13 +14,3 @@ def _wrapped(*args, **kwargs): finally: f.close() return _wrapped - -def test_all(): - suite = unittest.TestSuite() - for fname in glob.glob(os.path.join(here, '*.py')): - if '__init__' in fname: - continue - module = importlib.import_module('tests.' + os.path.basename(fname).split('.py')[0]) - if hasattr(module, 'suite'): - suite.addTest(module.suite()) - return suite diff --git a/tests/accuracytest.py b/tests/accuracytest.py index e85bb27..a30bb1a 100644 --- a/tests/accuracytest.py +++ b/tests/accuracytest.py @@ -155,9 +155,10 @@ def _bf(self, error_rate): def suite(): - suite = unittest.TestSuite() - suite.addTest(unittest.makeSuite(StringAccuracyMmapTestCase)) - suite.addTest(unittest.makeSuite(StringAccuracyMallocTestCase)) - suite.addTest(unittest.makeSuite(IntegerAccuracyMmapTestCase)) - suite.addTest(unittest.makeSuite(IntegerAccuracyMallocTestCase)) - return suite + loader = unittest.TestLoader() + return unittest.TestSuite(( + loader.loadTestsFromTestCase(StringAccuracyMmapTestCase), + loader.loadTestsFromTestCase(StringAccuracyMallocTestCase), + loader.loadTestsFromTestCase(IntegerAccuracyMmapTestCase), + loader.loadTestsFromTestCase(IntegerAccuracyMallocTestCase), + )) diff --git a/tests/simpletest.py b/tests/simpletest.py index 83f908d..4423593 100755 --- a/tests/simpletest.py +++ b/tests/simpletest.py @@ -416,6 +416,5 @@ def test_pickle(self): self.assertEqual(bf.bit_array, unpickled.bit_array) def suite(): - suite = unittest.TestSuite() - suite.addTest(unittest.makeSuite(SimpleTestCase)) - return suite + loader = unittest.TestLoader() + return loader.loadTestsFromTestCase(SimpleTestCase)