isolyzer
isolyzer copied to clipboard
Unit test error for source dist
While trying to package this for Arch Linux I ran into some issues. I'm using the source tar.gz from PyPI for this packaging (isolyzer-1.4.0.tar.gz, from https://pypi.org/project/isolyzer/#files).
At least in this package it appears the unit tests fail due to missing files:
==================================================================================== test session starts ====================================================================================
platform linux -- Python 3.10.5, pytest-7.1.2, pluggy-1.0.0
rootdir: /home/arvid/src/aur/isolyzer/src/isolyzer-1.4.0
collected 6 items
tests/unit/test_isolyzer.py . [ 16%]
tests/unit/test_testfiles.py FsssF [100%]
========================================================================================= FAILURES ==========================================================================================
_________________________________________________________________________________ test_groundtruth_complete _________________________________________________________________________________
def test_groundtruth_complete():
"""
Test if all files in sizeDifferenceSectors
dictionary really exist
"""
for key in sizeDifferenceSectors:
thisFile = os.path.join(testFilesDir, key)
> assert os.path.isfile(thisFile)
E AssertionError: assert False
E + where False = <function isfile at 0x7f4243bfdea0>('/home/arvid/src/aur/isolyzer/src/isolyzer-1.4.0/testFiles/hfs.iso')
E + where <function isfile at 0x7f4243bfdea0> = <module 'posixpath' from '/usr/lib/python3.10/posixpath.py'>.isfile
E + where <module 'posixpath' from '/usr/lib/python3.10/posixpath.py'> = os.path
tests/unit/test_testfiles.py:73: AssertionError
_____________________________________________________________________________________ test_xml_is_valid _____________________________________________________________________________________
capsys = <_pytest.capture.CaptureFixture object at 0x7f4242e7d1e0>
def test_xml_is_valid(capsys):
"""
Run processImages function on all files in test corpus and
verify resulting XML output validates against XSD schema
"""
processImages(testFiles, 0)
# Capture output from stdout
captured = capsys.readouterr()
xmlOut = captured.out
# Parse XSD schema
> xmlschema_doc = etree.parse(xsdFile)
tests/unit/test_testfiles.py:132:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
src/lxml/etree.pyx:3536: in lxml.etree.parse
???
src/lxml/parser.pxi:1876: in lxml.etree._parseDocument
???
src/lxml/parser.pxi:1902: in lxml.etree._parseDocumentFromURL
???
src/lxml/parser.pxi:1805: in lxml.etree._parseDocFromFile
???
src/lxml/parser.pxi:1177: in lxml.etree._BaseParser._parseDocFromFile
???
src/lxml/parser.pxi:615: in lxml.etree._ParserContext._handleParseResultDoc
???
src/lxml/parser.pxi:725: in lxml.etree._handleParseResult
???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> ???
E OSError: Error reading file '/home/arvid/src/aur/isolyzer/src/isolyzer-1.4.0/xsd/isolyzer-v-1-0.xsd': failed to load external entity "/home/arvid/src/aur/isolyzer/src/isolyzer-1.4.0/xsd/isolyzer-v-1-0.xsd"
src/lxml/parser.pxi:652: OSError
================================================================================== short test summary info ==================================================================================
FAILED tests/unit/test_testfiles.py::test_groundtruth_complete - AssertionError: assert False
FAILED tests/unit/test_testfiles.py::test_xml_is_valid - OSError: Error reading file '/home/arvid/src/aur/isolyzer/src/isolyzer-1.4.0/xsd/isolyzer-v-1-0.xsd': failed to load external ent...
========================================================================== 2 failed, 1 passed, 3 skipped in 0.15s ===========================================================================
The unit test works on a git checkout, so presumably there are some files that are missing in the built source package.
Thanks for reporting this. Apparently this is the default behavior for PyPi source distributions, but I found this can be overruled by adding a manifest file:
https://packaging.python.org/en/latest/guides/using-manifest-in/
I'll have a look into this later. In the meantime it's probably a good idea to use the source distributions from Github, which are always complete.