Skip to content
New issue

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

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

Already on GitHub? # to your account

Test fails on OpenBSD at 2.2.0: At index 13 diff: b'\x00' != b'\x01' #5527

Open
catap opened this issue Dec 2, 2024 · 5 comments
Open

Test fails on OpenBSD at 2.2.0: At index 13 diff: b'\x00' != b'\x01' #5527

catap opened this issue Dec 2, 2024 · 5 comments

Comments

@catap
Copy link
Contributor

catap commented Dec 2, 2024

Problem

/build/pobj/beets-2.2.0/beets-2.2.0/test/plugins/test_aura.py:57
=================================== FAILURES ===================================
___________________ EmbedartCliTest.test_accept_similar_art ____________________

args = (<test.plugins.test_embedart.EmbedartCliTest testMethod=test_accept_similar_art>,)
kwargs = {}

    def wrapper(*args, **kwargs):
        if not ArtResizer.shared.can_compare:
            raise unittest.SkipTest("compare not available")
        else:
>           return test(*args, **kwargs)

test/plugins/test_embedart.py:38: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <test.plugins.test_embedart.EmbedartCliTest testMethod=test_accept_similar_art>

    @require_artresizer_compare
    def test_accept_similar_art(self):
        self._setup_data(self.abbey_similarpath)
        album = self.add_album_fixture()
        item = album.items()[0]
        self.run_command("embedart", "-y", "-f", self.abbey_artpath)
        config["embedart"]["compare_threshold"] = 20
        self.run_command("embedart", "-y", "-f", self.abbey_similarpath)
        mediafile = MediaFile(syspath(item.path))
    
>       assert (
            mediafile.images[0].data == self.image_data
        ), f"Image written is not {displayable_path(self.abbey_similarpath)}"
E       AssertionError: Image written is not /build/pobj/beets-2.2.0/beets-2.2.0/test/rsrc/abbey-similar.jpg
E       assert b'\xff\xd8\xf...8\x7f\xff\xd9' == b'\xff\xd8\xf...f\x00\xff\xd9'
E         
E         At index 13 diff: b'\x00' != b'\x01'
E         Use -v to get more diff

Setup

  • OS: OpenBSD-current
  • Python version: 3.11.10
  • beets version: 2.2.0
  • Turning off plugins made problem go away (yes/no): no
@snejus
Copy link
Member

snejus commented Dec 5, 2024

I know that embedart plugin depends on Pillow and ImageMagick, so the issue may have to do with this.

That's why in #5526 I suggested to exclude plugin tests from the sdist, since some of them depend not only on additional Python packages but also system packages, see below:

[tool.poetry.extras]
# inline comments note required external / non-python dependencies
absubmit = ["requests"] # extractor binary from https://acousticbrainz.org/download
aura = ["flask", "flask-cors", "Pillow"]
autobpm = ["librosa", "resampy"]
# badfiles # mp3val and flac
beatport = ["requests-oauthlib"]
bpd = ["PyGObject"] # python-gi and GStreamer 1.0+
chroma = ["pyacoustid"] # chromaprint or fpcalc
# convert # ffmpeg
docs = ["pydata-sphinx-theme", "sphinx"]
discogs = ["python3-discogs-client"]
embedart = ["Pillow"] # ImageMagick
embyupdate = ["requests"]
fetchart = ["beautifulsoup4", "langdetect", "Pillow", "requests"]
import = ["py7zr", "rarfile"]
# ipfs # go-ipfs
# keyfinder # KeyFinder
kodiupdate = ["requests"]
lastgenre = ["pylast"]
lastimport = ["pylast"]
lyrics = ["beautifulsoup4", "langdetect", "requests"]
metasync = ["dbus-python"]
mpdstats = ["python-mpd2"]
plexupdate = ["requests"]
reflink = ["reflink"]
replaygain = [
    "PyGObject",
] # python-gi and GStreamer 1.0+ or mp3gain/aacgain or Python Audio Tools or ffmpeg
scrub = ["mutagen"]
sonosupdate = ["soco"]
thumbnails = ["Pillow", "pyxdg"]
web = ["flask", "flask-cors"]

@catap
Copy link
Contributor Author

catap commented Dec 5, 2024

@snejus 13th byte in jpeg header probably version, see: https://github.com/corkami/formats/blob/master/image/jpeg.md

@snejus
Copy link
Member

snejus commented Dec 5, 2024

Hmm, I wonder why does it fail on your system?

@catap
Copy link
Contributor Author

catap commented Dec 5, 2024

@snejus well, it writes very different images. I had "hacked" the test as:

    @require_artresizer_compare
    def test_accept_similar_art(self):
        self._setup_data(self.abbey_similarpath)
        album = self.add_album_fixture()
        item = album.items()[0]
        self.run_command("embedart", "-y", "-f", self.abbey_artpath)
        config["embedart"]["compare_threshold"] = 20
        self.run_command("embedart", "-y", "-f", self.abbey_similarpath)
        mediafile = MediaFile(syspath(item.path))

        with open("/tmp/test-image_data.jpg", "wb") as f:
            f.write(self.image_data)

        with open("/tmp/test-mediafile.jpg", "wb") as f:
            f.write(mediafile.images[0].data)

        assert (
            mediafile.images[0].data == self.image_data
        ), f"Image written is not {displayable_path(self.abbey_similarpath)}"

And here an output as archive: images.tar.gz

Or as images:

  1. test-image_data.jpg:
    test-image_data

  2. test-mediafile.jpg:
    test-mediafile

@snejus
Copy link
Member

snejus commented Dec 10, 2024

Thanks so much for this! Interesting. I wonder whether that's not due to missing dependencies

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants