ENH: Run SWIG unit tests in CI action#30161
Merged
charris merged 3 commits intonumpy:mainfrom Nov 6, 2025
Merged
Conversation
…TestsFromTestCase()
The unit tests involving `<type>TestCase.testMaxWrongDim` do not work for `<type>` being one of `uchar`, `ushort`, `uint`, `ulong`, and `ulongLong` (which translate to `uint8`, `uint16`, `uint32`, `uint64`, and `uint64`, respectively). Instead of raising the expected `TypeError`, the unit tests raise `OverflowError`, with the error message “Python integer -1 out of bounds for <type>”. This is fixed by replacing the negative values in the argument of the `max` function by positive ones.
The unit tests will be run in the Linux workflow using the Makefile distributed in `tools/swig/test` directory. They are run after installation of NumPy in the system, ensuring that the C header files are correctly included (see GitHub issue [numpy#30131](numpy#30131)).
Member
|
Thanks @rlaboiss . |
cakedev0
pushed a commit
to cakedev0/numpy
that referenced
this pull request
Dec 5, 2025
* Replace deprecated unittest.makeSuite() by unittest.TestLoader().loadTestsFromTestCase() * Do not use negative values in argument of Tensor.<type>Max() The unit tests involving `<type>TestCase.testMaxWrongDim` do not work for `<type>` being one of `uchar`, `ushort`, `uint`, `ulong`, and `ulongLong` (which translate to `uint8`, `uint16`, `uint32`, `uint64`, and `uint64`, respectively). Instead of raising the expected `TypeError`, the unit tests raise `OverflowError`, with the error message “Python integer -1 out of bounds for <type>”. This is fixed by replacing the negative values in the argument of the `max` function by positive ones. * Run unit tests for the SWIG binding at the end of the sdist job The unit tests will be run in the Linux workflow using the Makefile distributed in `tools/swig/test` directory. They are run after installation of NumPy in the system, ensuring that the C header files are correctly included (see GitHub issue [numpy#30131](numpy#30131)).
IndifferentArea
pushed a commit
to IndifferentArea/numpy
that referenced
this pull request
Dec 7, 2025
* Replace deprecated unittest.makeSuite() by unittest.TestLoader().loadTestsFromTestCase() * Do not use negative values in argument of Tensor.<type>Max() The unit tests involving `<type>TestCase.testMaxWrongDim` do not work for `<type>` being one of `uchar`, `ushort`, `uint`, `ulong`, and `ulongLong` (which translate to `uint8`, `uint16`, `uint32`, `uint64`, and `uint64`, respectively). Instead of raising the expected `TypeError`, the unit tests raise `OverflowError`, with the error message “Python integer -1 out of bounds for <type>”. This is fixed by replacing the negative values in the argument of the `max` function by positive ones. * Run unit tests for the SWIG binding at the end of the sdist job The unit tests will be run in the Linux workflow using the Makefile distributed in `tools/swig/test` directory. They are run after installation of NumPy in the system, ensuring that the C header files are correctly included (see GitHub issue [numpy#30131](numpy#30131)).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is an attempt to address issue #30131. The solution implemented follows the @rgommers' recommendation to run the Makefile in the
tools/swig/test/directory at the very end of thesdistjob in thelinux.ymlworkflow.Besides the commit that adds the CI action commands, two other things needed to be fixed in the Python code of the files in the directory
tools/swig/test/test*.py:unittest.makeSuite()withunittest.TestLoader().loadTestsFromTestCase()uint8,uint16,uint32anduint64arraysIn my forked repository, I had to make further tweaks to the
linux.ymlworkflow, in order to run the CI action. My changes yielded the expected results.Closes: #30131