Skip to content
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

First stab at testing all the examples #69

Merged
merged 6 commits into from Mar 30, 2017
Merged

First stab at testing all the examples #69

merged 6 commits into from Mar 30, 2017

Conversation

decentral1se
Copy link
Contributor

@decentral1se decentral1se commented Mar 28, 2017

So, here's the big picture of what I was trying to do:

  • Remove all app.run(debug=True) from the examples (for importing later)
  • Programmatically import all example modules in conftest.py fixture
  • Import every app from every module and request the swagger spec and validate

The final step failed because the examples don't work :) Hence, we are getting somewhere.

You'd have to enable the Travis build since you are the admin of the project. Already up, nice!

Code is kinda messy as I hacked it together, but this could give you an idea. Feel free to remix/remove anything that you don't want. No ego here :)

I've enabled Tox and Travis (via the configuration files (.travis.yml and tox.ini) which can automate tedious testing of python projects).

I think we can use http://flex-swagger.readthedocs.io/en/latest/ for validation?

Follows from #64 (comment).

@decentral1se
Copy link
Contributor Author

Cool, so we can see the expected failure of example_blueprint.py in the latest build.

@rochacbruno
Copy link
Member

Hey you can replace this:

app.run()

with this

if __name__ == "__main__":
    app.run()

@decentral1se
Copy link
Contributor Author

decentral1se commented Mar 28, 2017

OK, I've tried that in d4a134c and it all works :)

@rochacbruno
Copy link
Member

The error is due missing pip install marshmallow apispec

@decentral1se
Copy link
Contributor Author

OK, I've added the missing dependencies. I also removed Tox (probably overkill).

@rochacbruno
Copy link
Member

@lwm I fixed the problem with blueprints and added blueprint example to examples/validation.py and also example_blueprint.py which was missing register_blueprint call.

You nees to rebase your PR.

@rochacbruno
Copy link
Member

You may have conflicts in examples/validation.py and in requirements.txt simply remove then from your stage doing.

git checkout examples/validation.py and git checkout requirements.txt

this must give you the version from master and may resolve your conflicts.

@decentral1se
Copy link
Contributor Author

Awesome! I've rebased and simplified my approach. Should be green!

This is because we will import each example in the tests
and do not need the app to run automatically.
@decentral1se
Copy link
Contributor Author

Fixup, fixup, fixup ... ok, I think it's ready for review now :)

@rochacbruno rochacbruno merged commit 46a4899 into flasgger:master Mar 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants