Commit 2f6152a1 authored by Yannick DAYER's avatar Yannick DAYER
Browse files

Merge branch 'test-arm64' into 'master'

Fix the tests for arm64

See merge request !61
parents 03eefb92 c0259b18
Pipeline #63727 passed with stages
in 26 minutes and 57 seconds
import pickle
import platform
import tempfile
import time
import imageio
import nose
import numpy as np
import bob.bio.video
......@@ -23,9 +21,10 @@ def test_video_as_array():
assert len(video) == 83, len(video)
assert video.indices == range(83), video.indices
assert video.shape == (83, 3, 480, 640), video.shape
if platform.machine() == "arm64" and platform.system() == "Darwin":
raise nose.SkipTest("Skipping test on arm64 macos")
np.testing.assert_equal(video[0][:, 0, 0], np.array([78, 103, 100]))
# arm64 ffmpeg loads videos with a difference of pixel value of +/-1
np.testing.assert_allclose(
video[0][:, 0, 0], np.array([78, 103, 100]), atol=1
)
video_slice = video[1:2, 1:-1, 1:-1, 1:-1]
assert video_slice.shape == (1, 1, 478, 638), video_slice.shape
......@@ -40,7 +39,10 @@ def test_video_as_array():
assert len(video) == 3, len(video)
assert video.indices == [13, 41, 69], video.indices
assert video.shape == (3, 3, 480, 640), video.shape
np.testing.assert_equal(video[-1][:, 0, 0], np.array([75, 100, 97]))
# arm64 ffmpeg loads videos with a difference of pixel value of +/-1
np.testing.assert_allclose(
video[-1][:, 0, 0], np.array([75, 100, 97]), atol=1
)
# pickle video and unpickle to see if it works
with tempfile.NamedTemporaryFile(suffix=".pkl") as f:
......@@ -90,11 +92,11 @@ def test_video_like_container():
container.save(container_path)
loaded_container = bob.bio.video.VideoLikeContainer.load(container_path)
if platform.machine() == "arm64" and platform.system() == "Darwin":
raise nose.SkipTest("Skipping test on arm64 macos")
np.testing.assert_allclose(loaded_container.indices, container.indices)
np.testing.assert_allclose(loaded_container.data, container.data)
assert container == loaded_container
# ffmpeg loads videos with a difference of pixel value of +/-5 on arm64
np.testing.assert_allclose(
loaded_container.data, np.array(container, dtype=int), atol=5
)
# test saving and loading None arrays
with tempfile.NamedTemporaryFile(suffix=".pkl") as f:
......
......@@ -200,7 +200,7 @@ class VideoAsArray:
and all(isinstance(idx, slice) for idx in index)
):
raise NotImplementedError(
f"Indxing like {index} is not supported yet!"
f"Indexing like {index} is not supported yet!"
)
# dask.array.from_array sometimes requests empty arrays
......
......@@ -43,14 +43,14 @@ test:
imports:
- {{ name }}
commands:
- nosetests --with-coverage --cover-package={{ name }} -sv {{ name }}
- pytest --verbose --cov {{ name }} --cov-report term-missing --cov-report html:{{ project_dir }}/sphinx/coverage --cov-report xml:{{ project_dir }}/coverage.xml --pyargs {{ name }}
- sphinx-build -aEW {{ project_dir }}/doc {{ project_dir }}/sphinx
- sphinx-build -aEb doctest {{ project_dir }}/doc sphinx
- conda inspect linkages -p $PREFIX {{ name }} # [not win]
- conda inspect objects -p $PREFIX {{ name }} # [osx]
requires:
- nose {{ nose }}
- pytest {{ pytest }}
- pytest-cov {{ pytest_cov }}
- coverage {{ coverage }}
- sphinx {{ sphinx }}
- sphinx_rtd_theme {{ sphinx_rtd_theme }}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment