Closed hyanwong closed 2 months ago
It fails because we're calling verify_image_behavior
with an image name of SecondLionImage.jpg
, which doesn't actually exist in wikimedia.
Ah, of course! I guess we could make that any string we like, and we could choose something with is probably going to exist indefinitely on wikimedia commons, any anything springs to mind (any of the public domain "featured images" will probably continue existing on wikimedia commons).
I pushed a change to fix the test. There was an additional issue with not having a licence string in the test entry.
Thanks!
By the way, if you are pushing to the branch with the ruff linting, you can pre-commit install
to get the linter to automatically run when you commit any changes. You might have done that already.
Thanks for fixing this @davidebbo: -real-apis
all passes now.
I implemented a "--real-apis" flag to the test suite so that we can use the real wiki & azure APIs for testing if we want. This has to use the correct QID, but can fake a negative OTT. All the test functions now save their images in a tmp directory, so we shouldn't risk stomping on existing data. We can't run all the parts of all the tests, because we can't guarantee the API replies (e.g. will we always get the same vernacular). But we can do some checking, e.g. the vernacular API call for Q140 should always generate one row that contains "Lion", and we can probably be guaranteed that there will be a picture (although we can't guarantee what the picture is)
However,
test_get_wiki_images.py::TestAPI
do not account for this flag: it's only TestCLI that does.