businho / pytest-ruff

MIT License
31 stars 9 forks source link

Bug: TypeError: format_file() takes 1 positional argument but 2 were given #9

Closed boidolr closed 11 months ago

boidolr commented 11 months ago

Using pytest-ruff v0.2:

self = <RuffFormatItem ruff::format>

    def runtest(self):
>       self.handler(self.fspath)
E       TypeError: format_file() takes 1 positional argument but 2 were given

I think the issue is that we get passed self here: https://github.com/businho/pytest-ruff/blob/main/pytest_ruff.py#L98

skellys commented 11 months ago

I had the same issue in #7 and put up a bugfix PR here, but I found one case where behavior isn't intuitive (that one failing test): https://github.com/businho/pytest-ruff/pull/8

iurisilvio commented 11 months ago

Fixed by #8. 🙏🏻

I was really interested in integrating ruff format, did a bad release for tat and didn't had time to make it work in my projects. 😞

skellys commented 11 months ago

glad i could help! cheers

boidolr commented 11 months ago

Thanks for the quick fix @skellys and @iurisilvio for providing this package :) Also sorry for duplicating the issue.