-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove swagger-tester dependency #551
Conversation
Codecov Report
@@ Coverage Diff @@
## master #551 +/- ##
=======================================
Coverage 99.52% 99.53%
=======================================
Files 80 80
Lines 5313 5341 +28
=======================================
+ Hits 5288 5316 +28
Misses 25 25
Continue to review full report at Codecov.
|
Kudos, SonarCloud Quality Gate passed!
|
Great work! These are indeed already somewhat overlapping with the tests in
I think it would be useful to keep this kind of separation in mind even though we abandon swagger-tester - the tests in |
Thinking aloud here: What this PR is missing is that it doesn't check that the returned data conforms to the shapes (return data types) specified in the OpenAPI spec file. I think swagger-tester did that, though I'm not 100% sure. There's a greater risk now that the app will not actually honor the contracts in the spec file. The tests could be extended so that they perform more detailed testing of the returned data, but that still wouldn't guarantee that it follows the spec file, just that the person who wrote the tests thinks that the tests are checking for the right things. It would be better to derive the tests automatically from the spec file, not to craft them manually. But unfortunately we cannot use swagger-tester anymore for this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
For the future, I checked some alternatives for swagger-tester:
|
Hi @juhoinkinen Schemathesis author here :)
I'd be happy to review the dependencies on the Schemathesis side so it is easier to install :) Let me know if there is anything I can help with on this matter |
I took another look at this, and on current master Schemathesis actually gets installed, but by backtracking Schemathesis to version 0.7.3. Trying to install the latest Schemathesis v3.12.3 this conflict message is printed out:
In Connexion the pyyaml version has been limited to <6 last June. However, because Annif is not using any Click 8 feature, at the moment the easiest way to resolve this for us would be to allow older Click, e.g. >= 7, which would allow Schemathesis older than 3.11.1. But as we have just updated to Click 8, which required some work to avoid other conflicts (#533), it's best just wait for Connexion to catch up. But maybe some other people could be facing the same conflict, so allowing older Click in Schemathesis could be considered, if Click 8 is not needed there. |
Thank you so much for providing the context! Indeed, there is no hard dependency on Click, so we can relax it a bit - I'll take a look at it soon :) |
The swagger-tester seems unmaintained and depends on connexion. Since Annif is switching to install connexion (#549) from its new PyPI project (named connexion2), the result is that connexion ends up to be installed twice (currently as
connexion v2.7.0
andconnexion2 v2.10.0
).This PR removes the swagger-tester dev dependency from Annif and adds self-written tests for REST API methods, so only
connexion2
will be installed.Also avoids running Flask in a background thread (at least explicitly) by using Flask's TestClient.
Now the tests cover basically only the status codes related to cases defined in
swagger/annif.yaml
. Should there be more detailed tests as in the tests intest_rest.py
? (Or are these tests already overlapping, like testing the same functionality...?)