I periodically struggle with finding a good way to write unit tests for a pywikibot app.
I've come to the conclusion that using unittest.mock to patch calls into pywikibot is
just not the way to go. It's certainly hermetic, but the overhead of building tests
is so high, it doesn't seem worth it. It's also not really the right level. For
sure, I'm testing my own code, which says "unit test", but I'm also
testing my understanding of how a real wiki behaves, which says "integration
test". I've done some work with making live calls to
test.wikipedia.org
<http://test.wikipedia.org/>, but I hate relying on external resources.
So, I think the next thing I'm going to try is spinning up a wiki locally and test
against that. Unfortunately, my docker-fu is pretty weak, so I'm seeking some advice
to avoid going off in the weeds on this.
I already have docker installed on my laptop. I guess now I need to find an appropriate
docker image to use. Could somebody point me at that? I'll also need some kind of
integration with pytest. I'm looking at pytest-docker
<https://pypi.org/project/pytest-docker/>, which seems like the right thing. Does
this seem reasonable?