Skip to content
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

1.3.0: tests/samples/others not included in sdist tarball #341

Closed
dvzrv opened this issue May 18, 2022 · 2 comments
Closed

1.3.0: tests/samples/others not included in sdist tarball #341

dvzrv opened this issue May 18, 2022 · 2 comments

Comments

@dvzrv
Copy link

dvzrv commented May 18, 2022

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) =======
@github-actions
Copy link

Thank you for raising your first issue! Your help to improve svglib is much appreciated!

archlinux-github pushed a commit to archlinux/svntogit-community that referenced this issue May 18, 2022
Switch to github tarball as sdist tarball on pypi does not include all necessary files.
deeplook/svglib#341
Remove unneeded quotes and curly braces.
Switch to PEP517.

git-svn-id: file:///srv/repos/svn-community/svn@1208312 9fca08f4-af9d-4005-b8df-a31f2cc04f65
archlinux-github pushed a commit to archlinux/svntogit-community that referenced this issue May 18, 2022
Switch to github tarball as sdist tarball on pypi does not include all necessary files.
deeplook/svglib#341
Remove unneeded quotes and curly braces.
Switch to PEP517.

git-svn-id: file:///srv/repos/svn-community/svn@1208312 9fca08f4-af9d-4005-b8df-a31f2cc04f65
@claudep
Copy link
Collaborator

claudep commented May 18, 2022

Thanks for the report. Hopefully the patch above should fix it for the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants