Coverage() constructor no longer accepts Path-like objects as config_file · Issue #1552 · nedbat/coveragepy (original) (raw)

Hi,

I have just discovered that Coverage() constructor only accepts a string as a config_file path now. I have built some automations around coverage and, until now, these scripts can pass a pathlib.Path as config_file to Coverage() —and it works.

Specifically, coverage now asserts that config_file is a string (coverage/config.py line 555).

I rather prefer that config_file can accept any Path-like object. I understand that coverage is mostly invoked via CLI a string seems a natural solution. However, when coverage is invoked programmatically it makes sense —at least to me— that Coverage() accepts strings and pathlib.Paths as well.

Of course, this is a minor issue —not really a bug.

I am running coverage 7.1.0 on Python 3.11.1

Thank you for your time.