TST: Parametrize numpy roundtrip to find failing case

Segfaults are annoying to debug.
This commit is contained in:
DWesl 2021-12-18 10:00:14 -05:00
parent 1c25d95d5a
commit b9fee08c59
2 changed files with 10 additions and 5 deletions

View File

@ -38,6 +38,7 @@ jobs:
run: |
C:\tools\cygwin\bin\python3.8 -m pip install pip wheel setuptools
C:\tools\cygwin\bin\python3.8 -m pip install -r requirements.txt
C:\tools\cygwin\bin\python3.8 -m pip install pytest-forked
- name: Build Pillow
run: |
@ -56,6 +57,7 @@ jobs:
C:\tools\cygwin\bin\mv .ci/test.sh .ci/test.sh.dos
C:\tools\cygwin\bin\dash -c "/bin/tr -d '\r' <.ci/test.sh.dos >.ci/test.sh"
C:\tools\cygwin\bin\chmod u+x .ci/test.sh
C:\tools\cygwin\bin\python3.8 -m pytest --forked Tests/test_numpy.py -k roundtrip
C:\tools\cygwin\bin\dash /usr/bin/xvfb-run -s '-screen 0 1024x768x24' .ci/test.sh .8
- name: After success

View File

@ -189,8 +189,9 @@ def test_putdata():
assert len(im.getdata()) == len(arr)
def test_roundtrip_eye():
for dtype in (
@pytest.mark.parametrize(
"dtype",
(
bool,
numpy.bool8,
numpy.int8,
@ -202,9 +203,11 @@ def test_roundtrip_eye():
float,
numpy.float32,
numpy.float64,
):
arr = numpy.eye(10, dtype=dtype)
numpy.testing.assert_array_equal(arr, numpy.array(Image.fromarray(arr)))
),
)
def test_roundtrip_eye(dtype):
arr = numpy.eye(10, dtype=dtype)
numpy.testing.assert_array_equal(arr, numpy.array(Image.fromarray(arr)))
def test_zero_size():