Skip to content

"Can't add file tracer data for unmeasured file" when a plugin is disabled. #1011

Closed
@nedbat

Description

@nedbat

(Originally reported with a reproducible case here: nedbat/django_coverage_plugin#69)

If a plugin is disabled, the collector will still try to record its association with the files, which will fail:

INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/usr/local/virtualenvs/tmp-91b59576424c64de/lib/python3.7/site-packages/_pytest/main.py", line 191, in wrap_session
INTERNALERROR>     session.exitstatus = doit(config, session) or 0
INTERNALERROR>   File "/usr/local/virtualenvs/tmp-91b59576424c64de/lib/python3.7/site-packages/_pytest/main.py", line 247, in _main
INTERNALERROR>     config.hook.pytest_runtestloop(session=session)
INTERNALERROR>   File "/usr/local/virtualenvs/tmp-91b59576424c64de/lib/python3.7/site-packages/pluggy/hooks.py", line 286, in __call__
INTERNALERROR>     return self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR>   File "/usr/local/virtualenvs/tmp-91b59576424c64de/lib/python3.7/site-packages/pluggy/manager.py", line 93, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR>   File "/usr/local/virtualenvs/tmp-91b59576424c64de/lib/python3.7/site-packages/pluggy/manager.py", line 87, in <lambda>
INTERNALERROR>     firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
INTERNALERROR>   File "/usr/local/virtualenvs/tmp-91b59576424c64de/lib/python3.7/site-packages/pluggy/callers.py", line 203, in _multicall
INTERNALERROR>     gen.send(outcome)
INTERNALERROR>   File "/usr/local/virtualenvs/tmp-91b59576424c64de/lib/python3.7/site-packages/pytest_cov/plugin.py", line 254, in pytest_runtestloop
INTERNALERROR>     self.cov_controller.finish()
INTERNALERROR>   File "/usr/local/virtualenvs/tmp-91b59576424c64de/lib/python3.7/site-packages/pytest_cov/engine.py", line 197, in finish
INTERNALERROR>     self.cov.stop()
INTERNALERROR>   File "/usr/local/virtualenvs/tmp-91b59576424c64de/lib/python3.7/site-packages/coverage/control.py", line 649, in save
INTERNALERROR>     data = self.get_data()
INTERNALERROR>   File "/usr/local/virtualenvs/tmp-91b59576424c64de/lib/python3.7/site-packages/coverage/control.py", line 703, in get_data
INTERNALERROR>     if self._collector and self._collector.flush_data():
INTERNALERROR>   File "/usr/local/virtualenvs/tmp-91b59576424c64de/lib/python3.7/site-packages/coverage/collector.py", line 426, in flush_data
INTERNALERROR>     self.covdata.add_file_tracers(self.mapped_file_dict(self.file_tracers))
INTERNALERROR>   File "/usr/local/virtualenvs/tmp-91b59576424c64de/lib/python3.7/site-packages/coverage/sqldata.py", line 516, in add_file_tracers
INTERNALERROR>     "Can't add file tracer data for unmeasured file '%s'" % (filename,)
INTERNALERROR> coverage.misc.CoverageException: Can't add file tracer data for unmeasured file '/private/tmp/pytest_django_coverage_test/render_something/templates/render_something/index.html'

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions