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?
_______________________________________________
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/CWHCIIBZR54OVZIUNN6BDOWUHQGEEB53/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org

Reply via email to