Coding 2022-03-28
So, I looked into setting up pytest to test my Mypy plugin. I knew of two pytest plugins that are meant for that. Here is a quick rundown:
- pytest-mypy-plugins
- Pros:
- Flexible
- Extensible
- Expressive
- Cons:
- It turns out I don't like embedding Python in YAML
- Many fiddly levers that might result in something bad happening if you have the wrong combination of settings.
- I never figured out how to get it to work under MOTR, and I don't remember if I got it working with virtualenvs without forking it, and I definitely did fork it
- Pros:
- pytest-mypy-testing
- Pros:
- Runs with minimal configuration, both outside of and under MOTR
- Test sources are just Python
- I checked to see if it handles all of the issues that pytest-mypy-plugins expected me to coordinate myself, and from inspecting the source, it looks like the answer is yes
- Cons:
- Can't handle some of the more advanced cases that pytest-mypy-plugins does. For what it's worth, I have not needed this yet.
- Lines can get really long, and if you run black on the file, it will probably break the tests, so, that's not ideal.
- Pros:
I just made that last point a little less bad by reading a bit more of the documentation.
Anyway, all of this testing is revealing that I'm pushing Mypy far enough past what's "supposed to" work, that for now, I should focus on tests based on my target motrfile layout.
So, I'm going to have to take a bit of a break to clear my head, and then I should absolutely be writing those tests. Until then...
Good night.