-
Notifications
You must be signed in to change notification settings - Fork 35
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
Widget templates not covered (when they are clearly used). #94
Comments
I believe this is because the function that sniffs the frame for the filename fails to work on a template render - it seems that the |
I'll create a PR shortly, but my patch seems to work (waiting on a CI run to check). @@ -104,5 +104,15 @@
def filename_for_frame(frame):
try:
- return frame.f_locals["self"].origin.name
- except (KeyError, AttributeError):
+ self = frame.f_locals["self"]
+ except KeyError:
return None
+
+ try:
+ return self.origin.name
+ except AttributeError:
+ pass
+
+ try:
+ return self[0].origin.name
+ except (IndexError, AttributeError):
+ pass |
schinckel
added a commit
to schinckel/django_coverage_plugin
that referenced
this issue
May 24, 2024
schinckel
added a commit
to schinckel/django_coverage_plugin
that referenced
this issue
May 24, 2024
schinckel
added a commit
to schinckel/django_coverage_plugin
that referenced
this issue
May 24, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have Widget such as:
and tests such as:
When I look at the coverage it shows 0% for this template although lines from
plans/plan_choice_widget.html
template are matched by the tests.My .coveragerc:
I am using
django-coverage-plugin
version3.1.0
, coverage version7.4.1
.More widget templates from my project are not matched.
Is this a known problem or should I gather more information?
The text was updated successfully, but these errors were encountered: