The following test failures occur with shared-mime-info-1.1 and do not occur with shared-mime-info-1.0. $ nosetests-3.3 ............................................FF......... ====================================================================== FAIL: test_get_type (test-mime.MimeTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/tmp/pyxdg/test/test-mime.py", line 59, in test_get_type self.check_mimetype(imgpng, 'image', 'png') File "/tmp/pyxdg/test/test-mime.py", line 15, in check_mimetype self.assertEqual(mimetype.subtype, subtype) AssertionError: 'x-apple-ios-png' != 'png' - x-apple-ios-png + png ====================================================================== FAIL: test_get_type2 (test-mime.MimeTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/tmp/pyxdg/test/test-mime.py", line 83, in test_get_type2 self.check_mimetype(Mime.get_type2(example_file('test.png')), 'image', 'png') File "/tmp/pyxdg/test/test-mime.py", line 15, in check_mimetype self.assertEqual(mimetype.subtype, subtype) AssertionError: 'x-apple-ios-png' != 'png' - x-apple-ios-png + png ---------------------------------------------------------------------- Ran 55 tests in 2.064s FAILED (failures=2)
What version of PyXDG is this with? It looks similar to bug #61817, which is already fixed in master. See also this mailing list thread: http://lists.freedesktop.org/archives/xdg/2013-March/012678.html
This bug is present in PyXDG 0.25 and git head. (PyXDG 0.25 has only failure in test_get_type. test_get_type2 was added after 0.25 release.)
Drat, it's an intermittent failure. Test runs randomly pass or fail. I'll have a look into it, thanks.
Unfortunately, according to the spec, both results are equally valid given the data shipped in SMI 1.1. The real fix is this change to the shared-mime-info data: http://cgit.freedesktop.org/xdg/shared-mime-info/commit/freedesktop.org.xml.in?id=0c41ac819d483b3de89de1c2e58cdfbcf1f0f3c7 But that didn't make it into 1.1. Ugh, I've got three bad options: - Ignore it, but image/png is an important mime type that could cause lots of problems if it's not correctly recognised. - Add a special case for png, but that's always horrible. - Preserve the order of globs read the file, which is presumably what other implementations do, but it's not required by the spec and it makes the code less tidy, pretty much just for this one bug. (Note to self - failure is repeatable by running PYTHONHASHSEED=2 nosetests-3.3)
shared-mime-info-1.2 was released, but it seems like this bug is still not fixed.
I later decided to avoid the problematic case in the tests: https://cgit.freedesktop.org/xdg/pyxdg/commit/?id=8f2888721b05b6298eb44d667bece464b7de5c8a
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.