Open GergelyKalmar opened 4 years ago
Interesting point, I checked other plugins I use and it seems like there is no "standard". pytest-black has a fixed string too, pytest-flake8 reports the ignored checks. I'm not sure if we should change it as it make break users code/infrastructure in case they check for the "isort-check" string in stdout. World is weird sometimes ;-)
Fair enough. Maybe I'll just create a pytest plugin to normalize this :).
def unified_reportinfo(item, prefix):
def reportinfo():
return (item.fspath, None, prefix + item.config.invocation_dir.bestrelpath(item.fspath))
return reportinfo
def pytest_collection_modifyitems(config, items):
for item in items:
source = item.nodeid.split('::')[-1].lower()
if source in ['isort', 'mypy', 'pylint']:
item.reportinfo = unified_reportinfo(item=item, prefix=f'[{source}] ')
Works like magic! I wish there was a nicer way than parsing the nodeid
, but I suppose you don't plan to change that anytime soon given that it may break things too.
It seems that tools like pylint use
[pylint] <filename>
as the header of failed tests:It would be excellent if pytest-isort could do it similarly instead of using
isort-check
in each header and noting the filename in the first line asERROR: <filename> Imports are incorrectly sorted.
.