Skip to content

Add tests for PDF generation #13

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

sergei-maertens
Copy link
Member

@sergei-maertens sergei-maertens commented Jun 5, 2025

Part of #6

Let's get those coverage numbers up :)

@codecov-commenter
Copy link

codecov-commenter commented Jun 5, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 70.96%. Comparing base (4304efd) to head (9ab05b4).

Additional details and impacted files
@@             Coverage Diff             @@
##             main      #13       +/-   ##
===========================================
+ Coverage   51.44%   70.96%   +19.52%     
===========================================
  Files          11       11               
  Lines         243      248        +5     
  Branches       24       23        -1     
===========================================
+ Hits          125      176       +51     
+ Misses        118       72       -46     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sergei-maertens sergei-maertens force-pushed the issue/6-add-weasyprint-tests branch 3 times, most recently from 56c9472 to 785b648 Compare June 10, 2025 18:16
And fixed some indentation issues.
@sergei-maertens sergei-maertens force-pushed the issue/6-add-weasyprint-tests branch from 785b648 to 011ce1a Compare June 10, 2025 18:42
@sergei-maertens sergei-maertens force-pushed the issue/6-add-weasyprint-tests branch from 011ce1a to e7d0fee Compare June 10, 2025 18:44
Now that there was good test coverage, there's an opportunity to
clean up the code, which should also make it easier to add tests
for the remaining uncovered branches.
It's possible a project opts in to a different kind of storage, e.g.
to get files on S3 and in those situations, a storage that's not a
subclass of FileSystemStorage is typically used. We can simulate the
expected behaviour by using the in memory storage shipped by Django.

Note that this storage does not set up a location, which the default
static files storage does (making sure every asset URL is prefixed
with settings.STATIC_URL). As such, the {% static %} template tag
effectively does nothing with this in-memory storage.
@sergei-maertens sergei-maertens marked this pull request as ready for review June 10, 2025 20:21
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.

2 participants