coveragepy / coveragepy/django_coverage_plugin
FILE_CHARSET error on a wagtail/django error
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 202
- Forks
- 38
- PR merge metrics
- No merged PRs in 30d
Description
Hello,
I'm trying to setup this plugin in a wagtail/django project (Django 4.0, wagtail 3.X). I have the package installed, set in the configuration for coverage and my django templates have the debug option as true.
When I run coverage run manage.py test I get the following error
File "C:\ProgramData\Anaconda3\envs\wagtail_venv\lib\site-packages\django_coverage_plugin\plugin.py", line 243, in line_number_range
line_map = self.get_line_map(filename)
File "C:\ProgramData\Anaconda3\envs\wagtail_venv\lib\site-packages\django_coverage_plugin\plugin.py", line 269, in get_line_map
template_source = read_template_source(filename)
File "C:\ProgramData\Anaconda3\envs\wagtail_venv\lib\site-packages\django_coverage_plugin\plugin.py", line 137, in read_template_source
text = f.read().decode(settings.FILE_CHARSET)
File "C:\ProgramData\Anaconda3\envs\wagtail_venv\lib\site-packages\django\conf\__init__.py", line 85, in __getattr__
val = getattr(self._wrapped, name)
AttributeError: 'Settings' object has no attribute 'FILE_CHARSET'. Did you mean: 'DEFAULT_CHARSET'?
C:\ProgramData\Anaconda3\envs\wagtail_venv\lib\site-packages\coverage\collector.py:406: CoverageWarning: Disabling plug-in 'django_coverage_plugin.DjangoTemplatePlugin' due to previous exception
This is disabling the plugin in coverage so I'm not getting any results.
Am I doing something wrong? or is something that needs to be fixed?
THank you
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with django_coverage_plugin/plugin.py, especially read_template_source at the traceback's line 137, and reproduce the failure with coverage run manage.py test in a Django 4.0 project. Check the charset setting used when reading templates; done means the plugin remains enabled and coverage results are produced without the FILE_CHARSET error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- django, python
- Domain
- testing-qa
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100