I tried to run tests for diff_cover==8.0.0 with pytest-perf==0.13.1 installed and the test collection failed:
________________________ ERROR collecting test session _________________________
/usr/lib/python3.9/vendor-packages/_pytest/runner.py:341: in from_call
result: Optional[TResult] = func()
/usr/lib/python3.9/vendor-packages/_pytest/runner.py:372: in <lambda>
call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
/usr/lib/python3.9/vendor-packages/_pytest/main.py:749: in collect
for x in self._collectfile(path):
/usr/lib/python3.9/vendor-packages/_pytest/main.py:602: in _collectfile
return ihook.pytest_collect_file(file_path=fspath, parent=self) # type: ignore[no-any-return]
/usr/lib/python3.9/vendor-packages/_pytest/config/compat.py:66: in fixed_hook
return hook(**kw)
/usr/lib/python3.9/vendor-packages/pluggy/_hooks.py:493: in __call__
return self._hookexec(self.name, self._hookimpls, kwargs, firstresult)
/usr/lib/python3.9/vendor-packages/pluggy/_manager.py:115: in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
/usr/lib/python3.9/vendor-packages/pytest_perf/plugin.py:33: in _collect_file_pytest7
if file_path.suffix == '.py' and 'pytest_perf' in file_path.read_text(
/usr/lib/python3.9/pathlib.py:1267: in read_text
return f.read()
/usr/lib/python3.9/codecs.py:322: in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
E UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc6 in position 72: invalid continuation byte
The failure is because the diff_cover-8.0.0/tests/fixtures/snippet_8859.py file is not in UTF-8 but _collect_file_pytest7 expects that all .py files are encoded in UTF-8.
The solution (or workaround) for the problem is obvious: uninstall or disable pytest-perf while running tests for diff_cover.
Anyway, I'm reporting this here for consideration to make pytest-perf more tolerant about file encodings. If that's not possible or desirable or whatever feel free to close this bug.
I tried to run tests for
diff_cover==8.0.0
withpytest-perf==0.13.1
installed and the test collection failed:The failure is because the
diff_cover-8.0.0/tests/fixtures/snippet_8859.py
file is not in UTF-8 but_collect_file_pytest7
expects that all.py
files are encoded in UTF-8.The solution (or workaround) for the problem is obvious: uninstall or disable
pytest-perf
while running tests fordiff_cover
.Anyway, I'm reporting this here for consideration to make
pytest-perf
more tolerant about file encodings. If that's not possible or desirable or whatever feel free to close this bug.Thank you.