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

Tests failing in sandbox #2820

Closed
jtojnar opened this Issue Apr 1, 2018 · 8 comments

Comments

Projects
None yet
2 participants
@jtojnar

jtojnar commented Apr 1, 2018

I am trying to update the package in Nix repositories but the following six tests fail:

  • TDirectoryTree.test_initial fails because /usr/bin does not exist in sandbox
  • TSourceEncoding.test_main missing coding comment in some files, how can this pass for anyone?
  • TLicense.test_main same thing with license comment
  • Tiscommand.test_unix again, /bin/ls does not exist in sandbox
  • TThumb.test_recreate_broken_cache_file needs $XDG_CACHE_HOME/thumbnails/normal to be manually created, why is it not created by get_thumbnail method?
  • TThumb.test_thumb fails even when the directory is created manually, no idea why

Error log: NixOS/nixpkgs#38122 (comment)

@lazka

This comment has been minimized.

Member

lazka commented Apr 1, 2018

Thanks.

lazka added a commit that referenced this issue Aug 30, 2018

@lazka

This comment has been minimized.

Member

lazka commented Aug 30, 2018

Not sure about the TThumb failures, thumbnails.get_thumbnail() should create the file and directory, but is apparently failing somehow..

The others should be fixed.

@lazka lazka added the needinfo label Aug 30, 2018

@jtojnar

This comment has been minimized.

jtojnar commented Aug 30, 2018

With ea77d50:

=================================== FAILURES ===================================
__________________________ TSourceEncoding.test_main ___________________________

self = <tests.test_source.TSourceEncoding testMethod=test_main>

    def test_main(self):
        for path in iter_py_paths():
            with open(path, "rb") as h:
                match = None
                for i, line in enumerate(h):
                    # https://www.python.org/dev/peps/pep-0263/
                    match = match or re.search(br"coding[:=]\s*([-\w.]+)",
                                               line)
                    if i >= 2:
                        break
                if match:
                    match = match.group(1)
                self.assertEqual(match, b"utf-8",
                                 msg="%s has no utf-8 source encoding set\n"
>                                    "Insert:\n# -*- coding: utf-8 -*-" % path)

tests/test_source.py:60:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/__init__.py:43: in assertEqual
    super().assertEqual(second, first, msg)
E   AssertionError: b'utf-8' != None : /build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/context.py has no utf-8 source encoding set
E   Insert:
E   # -*- coding: utf-8 -*-
______________________________ TLicense.test_main ______________________________

self = <tests.test_source.TLicense testMethod=test_main>

    def test_main(self):
        allowed = []
        for license in self.ALLOWED:
            allowed.append("".join(license.split()))

        found = set()
        missing = []
        for path in iter_py_paths():
            header = b""
            with open(path, "rb") as h:
                for line in h:
                    line = line.strip()
                    if not line.startswith(b"#"):
                        break
                    header += line.lstrip(b"# ") + b"\n"

            norm = b"".join(header.split())
            norm = norm.decode("utf-8")

            for license_ in allowed:
                if license_ in norm:
                    found.add(license_)
                    break
            else:
                missing.append(path)

>       self.assertFalse(missing, msg="Missing license: %r" % missing)
E       AssertionError: ['/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/context.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/middleware.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/processors.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/breadcrumbs.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/exceptions.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/base.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/events.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/versioning.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/__init__.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/utils/urlparse.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/utils/http.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/utils/stacks.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/utils/imports.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/utils/encoding.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/utils/compat.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/utils/ssl_match_hostname.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/utils/json.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/utils/transaction.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/utils/testutils.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/utils/wsgi.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/utils/conf.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/utils/__init__.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/utils/serializer/manager.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/utils/serializer/base.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/utils/serializer/__init__.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/scripts/runner.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/scripts/__init__.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/transport/http.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/transport/gevent.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/transport/threaded_requests.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/transport/registry.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/transport/eventlet.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/transport/exceptions.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/transport/requests.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/transport/base.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/transport/twisted.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/transport/threaded.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/transport/tornado.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/transport/__init__.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/conf/remote.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/conf/defaults.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/conf/__init__.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/handlers/logbook.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/handlers/logging.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/handlers/__init__.py'] is not false : Missing license: ['/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/context.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/middleware.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/processors.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/breadcrumbs.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/exceptions.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/base.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/events.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/versioning.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/__init__.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/utils/urlparse.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/utils/http.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/utils/stacks.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/utils/imports.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/utils/encoding.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/utils/compat.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/utils/ssl_match_hostname.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/utils/json.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/utils/transaction.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/utils/testutils.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/utils/wsgi.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/utils/conf.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/utils/__init__.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/utils/serializer/manager.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/utils/serializer/base.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/utils/serializer/__init__.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/scripts/runner.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/scripts/__init__.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/transport/http.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/transport/gevent.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/transport/threaded_requests.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/transport/registry.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/transport/eventlet.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/transport/exceptions.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/transport/requests.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/transport/base.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/transport/twisted.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/transport/threaded.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/transport/tornado.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/transport/__init__.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/conf/remote.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/conf/defaults.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/conf/__init__.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/handlers/logbook.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/handlers/logging.py', '/build/quodlibet/dist/tmpbuild/quodlibet/quodlibet/packages/raven/handlers/__init__.py']

tests/test_source.py:118: AssertionError
______________________________ TThumb.test_thumb _______________________________

s = <tests.test_util_thumbnails.TThumb testMethod=test_thumb>

    def test_thumb(s):
        thumb = thumbnails.get_thumbnail(s.filename, (50, 60))

        #check for right scaling
        s.failUnless(thumb)
        s.failUnlessEqual((thumb.get_width(), thumb.get_height()), (50, 25))

        #test the thumbnail filename
        uri = fsn2uri(s.filename)
        name = hash.md5(uri.encode("ascii")).hexdigest() + ".png"

        path = thumbnails.get_thumbnail_folder()
        path = os.path.join(path, "normal", name)

>       s.failUnless(os.path.isfile(path))
E       AssertionError: False is not true

tests/test_util_thumbnails.py:105: AssertionError
============== 3 failed, 2980 passed, 49 skipped in 99.43 seconds ==============

lazka added a commit that referenced this issue Aug 30, 2018

@jtojnar

This comment has been minimized.

jtojnar commented Aug 30, 2018

With the following patch

--- a/quodlibet/quodlibet/util/thumbnails.py
+++ b/quodlibet/quodlibet/util/thumbnails.py
@@ -123,14 +123,19 @@
 
     # embedded thumbnails come from /tmp/
     # FIXME: move this to another layer
+    print(gettempdir())
     if path.startswith(gettempdir()):
+        print("fixme move this to another")
         return new_from_file_at_size(path, width, height)
 
     thumb_path, thumb_size = get_cache_info(path, boundary)
     cache_dir = os.path.dirname(thumb_path)
     try:
+        print("Creating cache dir")
         mkdir(cache_dir, 0o700)
+        print("Created cache dir")
     except OSError:
+        print("Could not create cache dir")
         return new_from_file_at_size(path, width, height)
 
     try:
--- a/quodlibet/tests/test_util_thumbnails.py
+++ b/quodlibet/tests/test_util_thumbnails.py
@@ -102,6 +102,7 @@
         path = thumbnails.get_thumbnail_folder()
         path = os.path.join(path, "normal", name)
 
+        print(path)
         s.failUnless(os.path.isfile(path))
 
         #check for metadata

I am getting

----------------------------- Captured stdout call -----------------------------
/build
fixme move this to another
/build/tmp.HhJGZfKsgH/.cache/thumbnails/normal/eb3e565dd5dbea28fce1a39f01df9479.png
======== 1 failed, 3 passed, 1 skipped, 3027 deselected in 5.91 seconds ========

It seems to trigger this codepath therefore the thumbnail is never created.

@lazka

This comment has been minimized.

Member

lazka commented Aug 30, 2018

ah, thanks

lazka added a commit that referenced this issue Aug 30, 2018

tests: Don't fail if the tests are run in TMPDIR. See #2820
There is currently a hack to not store thumbnails for images
in TMPDIR as we use that for embedded images.
Skip this during tests.
@lazka

This comment has been minimized.

Member

lazka commented Aug 30, 2018

now?

@jtojnar

This comment has been minimized.

jtojnar commented Aug 30, 2018

All green, thank you.

@jtojnar jtojnar closed this Aug 30, 2018

@lazka

This comment has been minimized.

Member

lazka commented Aug 30, 2018

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment