Fix tests invocation on release CI worklow (#489)

* Employ unittest discovery CLI (back again)
* Fix (sometimes) broken import with the pyx_import
* Bump cibuildwheel to 2.9.0
* Build without libffi-devel

Co-authored-by: Fantix King <fantix.king@gmail.com>
This commit is contained in:
Ben Raz 2022-09-10 18:45:27 +03:00 committed by GitHub
parent 9c37930e6f
commit d6a2b597fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 23 additions and 26 deletions

View File

@ -110,16 +110,14 @@ jobs:
run: | run: |
brew install gnu-sed libtool autoconf automake brew install gnu-sed libtool autoconf automake
- uses: pypa/cibuildwheel@v2.8.0 - uses: pypa/cibuildwheel@v2.9.0
env: env:
CIBW_BUILD_VERBOSITY: 1 CIBW_BUILD_VERBOSITY: 1
CIBW_BUILD: ${{ matrix.cibw_python }} CIBW_BUILD: ${{ matrix.cibw_python }}
CIBW_ARCHS: ${{ matrix.cibw_arch }} CIBW_ARCHS: ${{ matrix.cibw_arch }}
# This is needed for now because cffi has no cp310 wheels
CIBW_BEFORE_ALL_LINUX: "yum -y install libffi-devel"
CIBW_TEST_EXTRAS: "test" CIBW_TEST_EXTRAS: "test"
CIBW_TEST_COMMAND: "python {project}/tests/__init__.py" CIBW_TEST_COMMAND: "python -m unittest discover -v {project}/tests"
CIBW_TEST_COMMAND_WINDOWS: "python {project}\\tests\\__init__.py" CIBW_TEST_COMMAND_WINDOWS: "python -m unittest discover -v {project}\\tests"
CIBW_TEST_SKIP: "*universal2:arm64" CIBW_TEST_SKIP: "*universal2:arm64"
- uses: actions/upload-artifact@v3 - uses: actions/upload-artifact@v3

View File

@ -47,9 +47,9 @@ docs:
test: test:
PYTHONASYNCIODEBUG=1 $(PYTHON) -m unittest -v tests.suite PYTHONASYNCIODEBUG=1 $(PYTHON) -m unittest discover -v tests
$(PYTHON) -m unittest -v tests.suite $(PYTHON) -m unittest discover -v tests
testinstalled: testinstalled:
cd "$${HOME}" && $(PYTHON) $(ROOT)/tests/__init__.py cd "$${HOME}" && $(PYTHON) -m unittest discover -v $(ROOT)/tests

View File

@ -1,17 +0,0 @@
import os.path
import sys
import unittest
import unittest.runner
def suite():
test_loader = unittest.TestLoader()
test_suite = test_loader.discover(
os.path.dirname(__file__), pattern='test_*.py')
return test_suite
if __name__ == '__main__':
runner = unittest.runner.TextTestRunner()
result = runner.run(suite())
sys.exit(not result.wasSuccessful())

16
tests/__main__.py Normal file
View File

@ -0,0 +1,16 @@
import os.path
import sys
import unittest
import unittest.runner
def suite():
test_loader = unittest.TestLoader()
test_suite = test_loader.discover(os.path.dirname(__file__))
return test_suite
if __name__ == '__main__':
runner = unittest.runner.TextTestRunner()
result = runner.run(suite())
sys.exit(not result.wasSuccessful())

View File

@ -13,7 +13,7 @@ class Test_UV_libuv(tb.UVTestCase):
pyximport.install() pyximport.install()
from tests import cython_helper import cython_helper
self.assertTrue(cython_helper.capsule_equals(cap1, cap2)) self.assertTrue(cython_helper.capsule_equals(cap1, cap2))
self.assertFalse(cython_helper.capsule_equals(cap1, cap3)) self.assertFalse(cython_helper.capsule_equals(cap1, cap3))