Skip to content

Commit

Permalink
Fix tests invocation on release CI worklow (#489)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
ben9923 and fantix authored Sep 10, 2022
1 parent 9c37930 commit d6a2b59
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 26 deletions.
8 changes: 3 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,16 +110,14 @@ jobs:
run: |
brew install gnu-sed libtool autoconf automake
- uses: pypa/cibuildwheel@v2.8.0
- uses: pypa/cibuildwheel@v2.9.0
env:
CIBW_BUILD_VERBOSITY: 1
CIBW_BUILD: ${{ matrix.cibw_python }}
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_COMMAND: "python {project}/tests/__init__.py"
CIBW_TEST_COMMAND_WINDOWS: "python {project}\\tests\\__init__.py"
CIBW_TEST_COMMAND: "python -m unittest discover -v {project}/tests"
CIBW_TEST_COMMAND_WINDOWS: "python -m unittest discover -v {project}\\tests"
CIBW_TEST_SKIP: "*universal2:arm64"

- uses: actions/upload-artifact@v3
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ docs:


test:
PYTHONASYNCIODEBUG=1 $(PYTHON) -m unittest -v tests.suite
$(PYTHON) -m unittest -v tests.suite
PYTHONASYNCIODEBUG=1 $(PYTHON) -m unittest discover -v tests
$(PYTHON) -m unittest discover -v tests


testinstalled:
cd "$${HOME}" && $(PYTHON) $(ROOT)/tests/__init__.py
cd "$${HOME}" && $(PYTHON) -m unittest discover -v $(ROOT)/tests
17 changes: 0 additions & 17 deletions tests/__init__.py
Original file line number Diff line number Diff line change
@@ -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 changes: 16 additions & 0 deletions tests/__main__.py
Original file line number Diff line number Diff line change
@@ -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())
2 changes: 1 addition & 1 deletion tests/test_libuv_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def test_libuv_get_loop_t_ptr(self):

pyximport.install()

from tests import cython_helper
import cython_helper

self.assertTrue(cython_helper.capsule_equals(cap1, cap2))
self.assertFalse(cython_helper.capsule_equals(cap1, cap3))
Expand Down

0 comments on commit d6a2b59

Please sign in to comment.