Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rare test failures on windows CI #409

Closed
zhiltsov-max opened this issue Aug 18, 2021 · 0 comments · Fixed by #443
Closed

Rare test failures on windows CI #409

zhiltsov-max opened this issue Aug 18, 2021 · 0 comments · Fixed by #443

Comments

@zhiltsov-max
Copy link
Contributor

zhiltsov-max commented Aug 18, 2021

It doesn't fail every time.

Example: https://github.com/openvinotoolkit/datumaro/pull/407/checks?check_run_id=3359354762

__________________________ BytesImageTest.test_ctors __________________________

self = <tests.test_images.BytesImageTest testMethod=test_ctors>

    @mark_requirement(Requirements.DATUM_GENERAL_REQ)
    def test_ctors(self):
        with TestDir() as test_dir:
            path = osp.join(test_dir, 'path.png')
            image = np.ones([2, 4, 3])
            image_bytes = encode_image(image, 'png')
    
            for args in [
                { 'data': image_bytes },
                { 'data': lambda _: image_bytes },
                { 'data': lambda _: image_bytes, 'ext': '.jpg' },
                { 'data': image_bytes, 'path': path },
                { 'data': image_bytes, 'path': path, 'size': (2, 4) },
                { 'data': image_bytes, 'path': path, 'size': (2, 4) },
                { 'path': path },
                { 'path': path, 'size': (2, 4) },
            ]:
                with self.subTest(**args):
                    img = ByteImage(**args)
                    # pylint: disable=pointless-statement
                    self.assertEqual('data' in args, img.has_data)
                    if img.has_data:
>                       self.assertEqual(img, image)

tests\test_images.py:126: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
datumaro\util\image.py:366: in __eq__
    return super().__eq__(other)
datumaro\util\image.py:311: in __eq__
    return self.has_data and np.array_equal(self.data, other)
datumaro\util\image.py:282: in data
    data = self._data()
datumaro\util\image.py:227: in __call__
    image = self.loader(self.path)
datumaro\util\image.py:338: in <lambda>
    loader = lambda _: decode_image(self.get_bytes())
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

image_bytes = <object object at 0x0000025118C7B6D0>
dtype = <class 'numpy.float32'>

    def decode_image(image_bytes, dtype=np.float32):
        if _IMAGE_BACKEND == _IMAGE_BACKENDS.cv2:
            import cv2
>           image = np.frombuffer(image_bytes, dtype=np.uint8)
E           TypeError: a bytes-like object is required, not 'object'

datumaro\util\image.py:155: TypeError
@zhiltsov-max zhiltsov-max changed the title Rare test failures on windows Rare test failures on windows CI Aug 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant