Hi! When trying to build 1.3.0 as a package for Arch Linux I ran into an issue with missing files.
It appears that tests/samples/others/*.svg are not included in sdist tarballs on pypi.org, which makes the tests fail:
=================================== FAILURES ===================================
________________________ TestOtherFiles.test_png_in_svg ________________________
self = <test_samples.TestOtherFiles object at 0x6d35c50df6d0>
@pytest.mark.skipif(not haveImages, reason="missing pillow library")
def test_png_in_svg(self):
path = join(TEST_ROOT, "samples", "others", "png_in_svg.svg")
drawing = svglib.svg2rlg(path)
> result = renderPDF.drawToString(drawing)
tests/test_samples.py:425:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.10/site-packages/reportlab/graphics/renderPDF.py:327: in drawToString
drawToFile(d, s, msg=msg, showBoundary=showBoundary,autoSize=autoSize, canvasKwds=canvasKwds)
/usr/lib/python3.10/site-packages/reportlab/graphics/renderPDF.py:293: in drawToFile
d = renderScaledDrawing(d)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
d = None
def renderScaledDrawing(d):
> renderScale = d.renderScale
E AttributeError: 'NoneType' object has no attribute 'renderScale'
/usr/lib/python3.10/site-packages/reportlab/graphics/renderbase.py:153: AttributeError
------------------------------ Captured log call -------------------------------
ERROR svglib.svglib:svglib.py:1505 Failed to load input file! (Error reading file '/build/python-svglib/src/svglib-1.3.0/tests/samples/others/png_in_svg.svg': failed to load external entity "/build/python-svglib/src/svglib-1.3.0/tests/samples/others/png_in_svg.svg")
___________________ TestOtherFiles.test_external_svg_in_svg ____________________
self = <test_samples.TestOtherFiles object at 0x6d35c50dff40>
def test_external_svg_in_svg(self):
path = join(TEST_ROOT, "samples", "others", "svg_in_svg.svg")
drawing = svglib.svg2rlg(path)
> img_group = drawing.contents[0].contents[0]
E AttributeError: 'NoneType' object has no attribute 'contents'
tests/test_samples.py:432: AttributeError
------------------------------ Captured log call -------------------------------
ERROR svglib.svglib:svglib.py:1505 Failed to load input file! (Error reading file '/build/python-svglib/src/svglib-1.3.0/tests/samples/others/svg_in_svg.svg': failed to load external entity "/build/python-svglib/src/svglib-1.3.0/tests/samples/others/svg_in_svg.svg")
_______________________ TestOtherFiles.test_em_unit_svg ________________________
self = <test_samples.TestOtherFiles object at 0x6d35c50df6a0>
def test_em_unit_svg(self):
path = join(TEST_ROOT, "samples", "others", "em_unit.svg")
drawing = svglib.svg2rlg(path)
> assert drawing.contents[0].transform[5] == svglib.DEFAULT_FONT_SIZE
E AttributeError: 'NoneType' object has no attribute 'contents'
tests/test_samples.py:445: AttributeError
------------------------------ Captured log call -------------------------------
ERROR svglib.svglib:svglib.py:1505 Failed to load input file! (Error reading file '/build/python-svglib/src/svglib-1.3.0/tests/samples/others/em_unit.svg': failed to load external entity "/build/python-svglib/src/svglib-1.3.0/tests/samples/others/em_unit.svg")
=============================== warnings summary ===============================
<frozen importlib._bootstrap>:283
<frozen importlib._bootstrap>:283: DeprecationWarning: the load_module() method is deprecated and slated for removal in Python 3.12; use exec_module() instead
tests/test_samples.py::TestW3CSVG::test_convert_pdf_png
/usr/lib/python3.10/site-packages/PIL/Image.py:992: UserWarning: Palette images with Transparency expressed in bytes should be converted to RGBA images
warnings.warn(
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
FAILED tests/test_samples.py::TestOtherFiles::test_png_in_svg - AttributeErro...
FAILED tests/test_samples.py::TestOtherFiles::test_external_svg_in_svg - Attr...
FAILED tests/test_samples.py::TestOtherFiles::test_em_unit_svg - AttributeErr...
======= 3 failed, 103 passed, 6 skipped, 2 warnings in 157.74s (0:02:37) =======
Hi! When trying to build 1.3.0 as a package for Arch Linux I ran into an issue with missing files. It appears that tests/samples/others/*.svg are not included in sdist tarballs on pypi.org, which makes the tests fail: