Adding pytest to project#313
Conversation
.github/workflows/validate.yaml
Outdated
| @@ -45,3 +45,25 @@ jobs: | |||
| with: | |||
| args: check --exit-zero # succeed despite errors until https://github.com/custom-components/zaptec/issues/258 is done | |||
| src: "." | |||
There was a problem hiding this comment.
Do we want to include the tests in the ruff check? (ref modification to exclude scripts in #307)
There was a problem hiding this comment.
(I was about to ask you the same question.) That up to us, really. I've been working with projects that have both with or without ruff in tests/. I think the argument goes something along the lines that the test code is an equal important piece of the quality of the code, hence it should have the same scrutiny as the main code. The other argument goes that tests often require some non-pythonic constructs and that following every rule in tests is being somewhat pedantic.
I'm leaning towards not including tests into the ruff check (for now at least). But I'm very keen on hearing your opinion before we settle this.
There was a problem hiding this comment.
From what I can tell, HA-core runs it on all files. So I'm inclined to say include tests for now, and if it gets really annoying/tedious, we can consider excluding it again.
There was a problem hiding this comment.
Yes. Smart to check what HA does. Then I agree, let's leave it to also check tests.
I think it's just a matter of setting |
Updated ruff check source path to include tests.
|
I added ruff check of tests to this PR. Please take a look at the results from the latest run. I see a few errors from ruff that we have to address to not get swamped by warnings. E.g. that assert has been encountered (which is expected in pytest). |
Fix #262