Navigation Menu

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

[python-asyncio] tests and fixes #7235

Merged
merged 5 commits into from Feb 1, 2018

Conversation

tomplus
Copy link
Contributor

@tomplus tomplus commented Dec 21, 2017

PR checklist

  • Read the contribution guidelines.
  • Ran the shell script under ./bin/ to update Petstore sample so that CIs can verify the change. (For instance, only need to run ./bin/{LANG}-petstore.sh and ./bin/security/{LANG}-petstore.sh if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in .\bin\windows\.
  • Filed the PR against the correct branch: 3.0.0 branch for changes related to OpenAPI spec 3.0. Default: master.
  • Copied the technical committee to review the pull request if your PR is targeting a particular programming language.

Description of the PR

I prepared some fixes (creating ssl context, sending queries with args, forms or files) and added some tests for python-asyncio.

PTAL: @wing328 @taxpon @frol @mbohlool @cbornet @kenjones-cisco @toumorokoshi

envlist = py27, py3
{{/asyncio}}
{{#asyncio}}
envlist = py3
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

asyncio with coroutine function definition requires Python 3.5+. I also switched from nosetest to pytest which supports asyncio.

@tomplus
Copy link
Contributor Author

tomplus commented Dec 21, 2017

Tests failed because Travis hasn't got Python 3.5+. Our Travis configuration is for Java and I'm not sure if it's possible to install other language. Do you know how I can configure it ?

@frol
Copy link
Contributor

frol commented Dec 21, 2017

The changes look good to me.

I vote for using pytest for all the types of the client. Any objectives?

I have no idea about Travis setup, so I cannot help here.

@wing328
Copy link
Contributor

wing328 commented Dec 21, 2017

Our Travis configuration is for Java and I'm not sure if it's possible to install other language. Do you know how I can configure it ?

It should be possible to update to a newer version of Python. I'll check later after 2.3.0 release.

@toumorokoshi
Copy link
Contributor

+1 for pytest as well. There's an asyncio pytest plugin that we could use:

https://pypi.python.org/pypi/pytest-asyncio

But I'm fine with the unit tests as is too, in the interest of just getting some form of coverage on these for now.

@tomplus
Copy link
Contributor Author

tomplus commented Dec 21, 2017

@toumorokoshi Thanks for your feedback.

Coverage is not very bad ;)

Name                                                                      Stmts   Miss  Cover
---------------------------------------------------------------------------------------------
petstore_api/__init__.py                                                     46      0   100%
petstore_api/api/__init__.py                                                  7      0   100%
petstore_api/api/another_fake_api.py                                         43     31    28%
petstore_api/api/fake_api.py                                                366    338     8%
petstore_api/api/fake_classname_tags_123_api.py                              43     31    28%
petstore_api/api/pet_api.py                                                 282     24    91%
petstore_api/api/store_api.py                                               138    120    13%
petstore_api/api/user_api.py                                                270    244    10%
petstore_api/api_client.py                                                  251     66    74%
petstore_api/configuration.py                                                88     17    81%
petstore_api/models/__init__.py                                              38      0   100%
petstore_api/models/additional_properties_class.py                           45     28    38%
petstore_api/models/animal.py                                                50     31    38%
petstore_api/models/animal_farm.py                                           32     18    44%
petstore_api/models/api_response.py                                          52     20    62%
petstore_api/models/array_of_array_of_number_only.py                         38     23    39%
petstore_api/models/array_of_number_only.py                                  38     23    39%
petstore_api/models/array_test.py                                            53     33    38%
petstore_api/models/capitalization.py                                        73     48    34%
petstore_api/models/cat.py                                                   39     23    41%
petstore_api/models/category.py                                              45     17    62%
petstore_api/models/class_model.py                                           38     23    39%
petstore_api/models/client.py                                                38     23    39%
petstore_api/models/dog.py                                                   39     23    41%
petstore_api/models/enum_arrays.py                                           51     34    33%
petstore_api/models/enum_class.py                                            34     18    47%
petstore_api/models/enum_test.py                                             69     47    32%
petstore_api/models/format_test.py                                          154    115    25%
petstore_api/models/has_only_read_only.py                                    45     28    38%
petstore_api/models/list.py                                                  38     23    39%
petstore_api/models/map_test.py                                              48     31    35%
petstore_api/models/mixed_properties_and_additional_properties_class.py      53     33    38%
petstore_api/models/model_200_response.py                                    45     28    38%
petstore_api/models/model_return.py                                          38     23    39%
petstore_api/models/name.py                                                  60     39    35%
petstore_api/models/number_only.py                                           38     23    39%
petstore_api/models/order.py                                                 76     51    33%
petstore_api/models/outer_boolean.py                                         31     18    42%
petstore_api/models/outer_composite.py                                       55     33    40%
petstore_api/models/outer_enum.py                                            34     18    47%
petstore_api/models/outer_number.py                                          31     18    42%
petstore_api/models/outer_string.py                                          31     18    42%
petstore_api/models/pet.py                                                   80     20    75%
petstore_api/models/read_only_first.py                                       45     28    38%
petstore_api/models/special_model_name.py                                    38     23    39%
petstore_api/models/tag.py                                                   45     17    62%
petstore_api/models/user.py                                                  87     58    33%
petstore_api/rest.py                                                        104     22    79%
---------------------------------------------------------------------------------------------
TOTAL                                                                      3482   1970    43%

@tomplus
Copy link
Contributor Author

tomplus commented Jan 25, 2018

@wing328 I'll be glad if you find time to help me with Travis here.

@wing328
Copy link
Contributor

wing328 commented Jan 26, 2018

@tomplus I'll give it a try over the coming weekend. Will keep you posted.

@wing328
Copy link
Contributor

wing328 commented Jan 28, 2018

According to https://docs.travis-ci.com/user/build-environment-updates/2017-12-12/, it should be running Python 3.6.3 but seems like it's not the case. I've contacted Travis support to look into this.

@wing328
Copy link
Contributor

wing328 commented Jan 30, 2018

Got the reply from Travis support and I was able to get the tests passed with 3.6.3 (not 3.5.x).

If this is ok, I'll merge this PR by tomorrow (Wednesday)

@wing328 wing328 merged commit f6e0e29 into swagger-api:master Feb 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants