Closed thopiekar closed 6 years ago
The test works correctly on CI, so I do directly know what is wrong. Can you check whether it returns a custom mime type or a mime type from Qt's mime type database?
How shall I check for it?
Probably need to add some logging to MimeTypeDatabase::getMimeTypeForFile
I have the same failure on the Fedora package:
=================================== FAILURES ===================================
___________________________ test_getMimeTypeForFile ____________________________
mime_database = <class 'UM.MimeTypeDatabase.MimeTypeDatabase'>
def test_getMimeTypeForFile(mime_database):
path_base = os.path.dirname(os.path.abspath(__file__))
mime = mime_database.getMimeTypeForFile(os.path.join(path_base, "test.jpg"))
assert mime.comment == "Custom JPEG MIME Type" # We must get the custom one, not Qt's MIME type.
mime = mime_database.getMimeTypeForFile(os.path.join(path_base, "test.png"))
assert mime.name == "image/png" # Getting a file type from the system.
mime = mime_database.getMimeTypeForFile(os.path.join(path_base, "file.test"))
assert mime.name == "application/x-test"
mime = mime_database.getMimeTypeForFile(os.path.join(path_base, "filetest.test.test")) # Double extension should still match
assert mime.name == "application/x-test"
mime = mime_database.getMimeTypeForFile(os.path.join(path_base, ".test")) # Only extension should still match
assert mime.name == "application/x-test"
with pytest.raises(MimeTypeNotFoundError):
mime_database.getMimeTypeForFile(os.path.join(path_base, "pink.unicorn")) # Non-existent file type.
with pytest.raises(MimeTypeNotFoundError):
> mime_database.getMimeTypeForFile(os.path.join(path_base, "filetest")) # File that happens to end in the extension without being an extension.
E Failed: DID NOT RAISE <class 'UM.MimeTypeDatabase.MimeTypeNotFoundError'>
tests/MimeTypes/TestMimeTypes.py:172: Failed
Returned <MimeType name=application/x-test>
.
Well, for me it seems like the issue is gone.
Since we are using Jenkins for CI I took a look on the output in im PPA builds and there seems to be something wrong
Full log: https://launchpadlibrarian.net/307193376/buildlog_ubuntu-zesty-amd64.uranium_1%3A2.4.99-master~201702201543~rev1744~pkg137~ubuntu17.04.1_BUILDING.txt.gz