Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Collect coverage data when rendering widgets. #95

Closed
wants to merge 1 commit into from

Conversation

schinckel
Copy link

Resolves #94

@schinckel
Copy link
Author

Okay, this doesn't actually collect coverage on real code.

It seems to be because line_number_range(frame) bails out if the self object is an instance of django.template.base.Template, which the template used for rendering widgets is, even when using the django template backend/engine.

@nedbat do you recall why this is?

if isinstance(render_self, (NodeList, Template)):

@schinckel
Copy link
Author

Ah, think I figured that out - it's the nodes within a template that have the line numbers available.

The issue is that form templates use a different rendering thing, which is in a different python file, so is being omitted by file_tracer.

@schinckel
Copy link
Author

Ah, turns out it needs settings.FORM_RENDERER to be set to 'django.forms.renderers.TemplatesSetting'

@schinckel schinckel closed this Jun 21, 2024
@schinckel schinckel deleted the widget-template branch June 21, 2024 04:12
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Widget templates not covered (when they are clearly used).
1 participant