Skip to content

Adding a test framework for sphinx-simplepdf#121

Open
kreuzberger wants to merge 25 commits intouseblocks:mainfrom
procitec:adding_tests
Open

Adding a test framework for sphinx-simplepdf#121
kreuzberger wants to merge 25 commits intouseblocks:mainfrom
procitec:adding_tests

Conversation

@kreuzberger
Copy link
Contributor

First implementation of a tox based test framework, trying to handle issues #112 and #120 in current versions

@kreuzberger
Copy link
Contributor Author

kreuzberger commented Nov 25, 2025

Currently there is no github action to perform tests, nor are lint tests etc working. The only tests working are e.g.
tox -e py313-sphinx82
which will lead to errors due to #112.

E       assert 16 == 0
E        +  where 16 = len(["ERROR: Content discarded: target points to undefined anchor ('url', ('internal', 'document-chapter1#section-1-1'))",...ion-1-1 for internal URI reference', 'ERROR: No anchor #document-chapter1#section-1-1 for internal URI reference', ...])

@kreuzberger
Copy link
Contributor Author

for #120 and sphinx 7.4 the tests fails cause the links associcated with Chapter 1 should lead to page 4 and the Chapter 2 links to page 5. In the current version they links to page 3/4.

      text = extract_pdf_text(pdf_path)
    
>       assert """
    Table of Contents
    
    Contents:
    
    Chapter 1: Getting Started
    
    • Section 1.1
    • Section 1.2
    
    Chapter 2: Advanced Topics
    
    • Section 2.1
    • Section 2.2
    
    4
    
    4
    
    4
    
    5
    
    5
    
    5
    """ in text

@kreuzberger
Copy link
Contributor Author

@ubmarco any suggestions?

@kreuzberger
Copy link
Contributor Author

This is related to #119, also introducing a pyproject.toml file.

@ubmarco
Copy link
Member

ubmarco commented Jan 23, 2026

The PR #119 got merged, please rebase this

@kreuzberger
Copy link
Contributor Author

This branch / pull request needs a review by a real python developer. I tried to merge by best knowledge, but due to my main scope (c++) i am not sure how to handle all the stuff in pyproject.toml.
E.g. the question if the dependencies for the documents should be an extra or an group dependeny and so on.

@kreuzberger
Copy link
Contributor Author

The relations between the demo project and the doc projects seems to be covered now, but i have no idea thats the difference between the /Sphinx-SimplePDF-DEMO.pdf and the also referenced /Sphinx-SimplePDF.pdf

Some targets now work, e.g. make test with sphinx < 8.2, some are not (e.g. make linkcheck)

@kreuzberger
Copy link
Contributor Author

❗ should not be merged until windows tests are also successfull. currently disabled but on work....

@kreuzberger
Copy link
Contributor Author

Looking at the main branch, i see that weasyprint also does not work there.
The build jobs results are good, but if you look at the output, you see that weasyprint crashes with segfault.

WARNING: CalledProcessError in weasyprint, retrying
Command '['weasyprint', 'D:\\a\\sphinx-simplepdf\\sphinx-simplepdf\\docs\\_build\\simplepdf\\index.html', 'D:\\a\\sphinx-simplepdf\\sphinx-simplepdf\\docs\\_build\\simplepdf\\Sphinx-SimplePDF.pdf']' returned non-zero exit status 3221225477.

@kreuzberger kreuzberger marked this pull request as draft January 27, 2026 15:52
@kreuzberger
Copy link
Contributor Author

Hi!
@ubmarco : I cannot properly finish this branch like i intended, cause the test do not work on windows. This is related to #130, the pdf builds for the doc project also do not build (status is green, but weasyprint return with nonzero exit code).
I do not know how to proceed, please lets discuss.

@kreuzberger kreuzberger marked this pull request as ready for review January 29, 2026 11:40
@kreuzberger
Copy link
Contributor Author

Yeah, 😀 , this was hard work 💪 but glad to finish it at the end with success 🎉

@ubmarco , @danwos : This is just a beginning if you see our discussions at #83, but you see how important even for simple tests of the extension it is helpful.

PDF Generation out of the requirement documents is not just a gimmick, from our customers’ and managers’ perspective, this is a must-have acceptance criterion ❗

@aanagnosastronauticscom

PDF Generation out of the requirement documents is not just a gimmick, from our customers’ and managers’ perspective, this is a must-have acceptance criterion ❗

Very true, internally, i have, a 3 digit number of tests covering PDF generation.
You simply can't give HTML to a great number of corporate and government entities.

@kreuzberger
Copy link
Contributor Author

kreuzberger commented Jan 30, 2026

PDF Generation out of the requirement documents is not just a gimmick, from our customers’ and managers’ perspective, this is a must-have acceptance criterion ❗

Very true, internally, i have, a 3 digit number of tests covering PDF generation. You simply can't give HTML to a great number of corporate and government entities.

We do the same, currently we use libpdf for this in our test environment for the pdfs.
To avoid inter-extension dependencies (libpdf currently has mutually exclusive dependencies) i currently use just pdfminer.six here.

If you want it could be helpful to share your experience in #83 with tips and suggestions about what and how you test

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

Successfully merging this pull request may close these issues.

3 participants