From 00dcbf3854caa5d8a60cdde07f43190a39e943a7 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Tue, 10 Dec 2019 10:49:33 -0800 Subject: [PATCH 1/4] Switches python generators to use pytest, useNose CLI option added if to allow nose to be used instead --- bin/python-server-all.sh | 1 + .../PythonAbstractConnexionServerCodegen.java | 12 ++++++++++++ .../PythonAiohttpConnexionServerCodegen.java | 1 + .../codegen/languages/PythonClientCodegen.java | 17 +++++++++++++++-- .../python-aiohttp/test-requirements.mustache | 9 ++++++++- .../main/resources/python-aiohttp/tox.mustache | 9 +++++++++ .../python-blueplanet/app/gitignore.mustache | 1 + .../app/test-requirements.mustache | 9 ++++++++- .../python-blueplanet/app/tox.mustache | 3 +-- .../resources/python-flask/gitignore.mustache | 2 ++ .../python-flask/requirements.mustache | 5 ++++- .../python-flask/test-requirements.mustache | 9 ++++++++- .../main/resources/python-flask/tox.mustache | 3 +-- .../main/resources/python/gitignore.mustache | 2 ++ .../test-requirements.mustache | 16 ++++++++-------- .../resources/python/test-requirements.mustache | 13 +++++++------ .../src/main/resources/python/tox.mustache | 8 +------- .../options/PythonClientOptionsProvider.java | 2 ++ .../codegen/python/PythonClientOptionsTest.java | 3 +++ .../client/petstore/python-asyncio/.gitignore | 2 ++ .../python-asyncio/dev-requirements.txt | 2 -- .../python-asyncio/test-requirements.txt | 8 +++----- .../petstore/python-asyncio/test_python3.sh | 1 - samples/client/petstore/python-asyncio/tox.ini | 2 +- .../petstore/python-experimental/.gitignore | 2 ++ .../python-experimental/dev-requirements.txt | 3 --- .../client/petstore/python-experimental/pom.xml | 2 +- .../petstore/python-experimental/setup.cfg | 9 --------- .../python-experimental/test-requirements.txt | 11 ++++------- .../python-experimental/test_python2.sh | 4 +--- .../python-experimental/test_python2_and_3.sh | 1 - .../client/petstore/python-experimental/tox.ini | 3 +-- .../client/petstore/python-tornado/.gitignore | 2 ++ .../python-tornado/dev-requirements.txt | 3 --- samples/client/petstore/python-tornado/pom.xml | 2 +- .../python-tornado/test-requirements.txt | 8 +++----- .../python-tornado/test_python2_and_3.sh | 1 - samples/client/petstore/python-tornado/tox.ini | 3 +-- samples/client/petstore/python/.gitignore | 2 ++ .../client/petstore/python/dev-requirements.txt | 3 --- samples/client/petstore/python/pom.xml | 2 +- samples/client/petstore/python/setup.cfg | 9 --------- .../petstore/python/test-requirements.txt | 8 +++----- samples/client/petstore/python/test_python2.sh | 6 ++---- .../petstore/python/test_python2_and_3.sh | 1 - .../petstore/python/tests/test_pet_api.py | 4 ++-- samples/client/petstore/python/tox.ini | 3 +-- .../openapi3/client/petstore/python/.gitignore | 2 ++ .../client/petstore/python/dev-requirements.txt | 2 ++ samples/openapi3/client/petstore/python/pom.xml | 2 +- .../petstore/python/test-requirements.txt | 8 +++----- .../client/petstore/python/test_python2.sh | 3 +-- .../petstore/python/test_python2_and_3.sh | 1 - samples/openapi3/client/petstore/python/tox.ini | 3 +-- .../petstore/python-flask-python2/.gitignore | 2 ++ .../python-flask-python2/requirements.txt | 5 ++++- .../python-flask-python2/test-requirements.txt | 10 ++++------ .../petstore/python-flask-python2/tox.ini | 3 +-- .../server/petstore/python-flask/.gitignore | 2 ++ .../petstore/python-flask/requirements.txt | 5 ++++- .../petstore/python-flask/test-requirements.txt | 10 ++++------ .../server/petstore/python-flask/tox.ini | 3 +-- .../python-aiohttp/dev-requirements.txt | 2 ++ samples/server/petstore/python-aiohttp/pom.xml | 2 +- .../python-aiohttp/test-requirements.txt | 8 +++----- .../petstore/python-aiohttp/test_python3.sh | 11 +++++------ samples/server/petstore/python-aiohttp/tox.ini | 9 +++++++++ .../.openapi-generator/VERSION | 2 +- .../petstore/python-blueplanet/app/.gitignore | 1 + .../python-blueplanet/app/test-requirements.txt | 10 ++++------ .../petstore/python-blueplanet/app/tox.ini | 3 +-- .../petstore/python-flask-python2/.gitignore | 2 ++ .../python-flask-python2/dev-requirements.txt | 2 ++ .../petstore/python-flask-python2/pom.xml | 2 +- .../python-flask-python2/requirements.txt | 5 ++++- .../python-flask-python2/test-requirements.txt | 10 ++++------ .../python-flask-python2/test_python2.sh | 13 ++++++------- .../petstore/python-flask-python2/tox.ini | 3 +-- samples/server/petstore/python-flask/.gitignore | 2 ++ .../petstore/python-flask/dev-requirements.txt | 2 ++ samples/server/petstore/python-flask/pom.xml | 2 +- .../petstore/python-flask/requirements.txt | 5 ++++- .../petstore/python-flask/test-requirements.txt | 10 ++++------ .../petstore/python-flask/test_python3.sh | 11 +++++------ samples/server/petstore/python-flask/tox.ini | 3 +-- 85 files changed, 225 insertions(+), 188 deletions(-) create mode 100644 modules/openapi-generator/src/main/resources/python-aiohttp/tox.mustache create mode 100644 samples/openapi3/client/petstore/python/dev-requirements.txt create mode 100644 samples/server/petstore/python-aiohttp/dev-requirements.txt create mode 100644 samples/server/petstore/python-aiohttp/tox.ini create mode 100644 samples/server/petstore/python-flask-python2/dev-requirements.txt create mode 100644 samples/server/petstore/python-flask/dev-requirements.txt diff --git a/bin/python-server-all.sh b/bin/python-server-all.sh index 5a4f5c754891..5fe3176eed9e 100755 --- a/bin/python-server-all.sh +++ b/bin/python-server-all.sh @@ -3,3 +3,4 @@ ./bin/python-server-aiohttp-petstore.sh ./bin/python-server-flask-petstore.sh ./bin/python-server-flask-petstore-python2.sh +./bin/python-server-blueplanet-petstore.sh diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonAbstractConnexionServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonAbstractConnexionServerCodegen.java index 5d6c5ca102ec..5b6e133cac2a 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonAbstractConnexionServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonAbstractConnexionServerCodegen.java @@ -48,6 +48,8 @@ public class PythonAbstractConnexionServerCodegen extends DefaultCodegen impleme public static final String CONTROLLER_PACKAGE = "controllerPackage"; public static final String DEFAULT_CONTROLLER = "defaultController"; public static final String SUPPORT_PYTHON2 = "supportPython2"; + // nose is a python testing framework, we use pytest if USE_NOSE is unset + public static final String USE_NOSE = "useNose"; static final String MEDIA_TYPE = "mediaType"; protected int serverPort = 8080; @@ -57,6 +59,7 @@ public class PythonAbstractConnexionServerCodegen extends DefaultCodegen impleme protected String defaultController; protected Map regexModifiers; protected boolean fixBodyName; + protected boolean useNose = Boolean.FALSE; public PythonAbstractConnexionServerCodegen(String templateDirectory, boolean fixBodyNameValue) { super(); @@ -156,6 +159,8 @@ public PythonAbstractConnexionServerCodegen(String templateDirectory, boolean fi defaultValue("false")); cliOptions.add(new CliOption("serverPort", "TCP port to listen to in app.run"). defaultValue("8080")); + cliOptions.add(CliOption.newBoolean(USE_NOSE, "use the nose test framework"). + defaultValue(Boolean.FALSE.toString())); } protected void addSupportingFiles() { @@ -200,6 +205,9 @@ public void processOpts() { additionalProperties.put(SUPPORT_PYTHON2, Boolean.TRUE); typeMapping.put("long", "long"); } + if (additionalProperties.containsKey(USE_NOSE)) { + setUseNose((String) additionalProperties.get(USE_NOSE)); + } supportingFiles.add(new SupportingFile("__main__.mustache", packagePath(), "__main__.py")); supportingFiles.add(new SupportingFile("util.mustache", packagePath(), "util.py")); supportingFiles.add(new SupportingFile("typing_utils.mustache", packagePath(), "typing_utils.py")); @@ -214,6 +222,10 @@ public void processOpts() { controllerPackage = packageName + "." + controllerPackage; } + public void setUseNose(String val) { + this.useNose = Boolean.valueOf(val); + } + private static String packageToPath(String pkg) { return pkg.replace(".", File.separator); } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonAiohttpConnexionServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonAiohttpConnexionServerCodegen.java index 0f725396b660..5fc23457e3da 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonAiohttpConnexionServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonAiohttpConnexionServerCodegen.java @@ -44,5 +44,6 @@ protected void addSupportingFiles() { supportingFiles.add(new SupportingFile("conftest.mustache", testPackage, "conftest.py")); supportingFiles.add(new SupportingFile("__init__test.mustache", testPackage, "__init__.py")); supportingFiles.add(new SupportingFile("__init__main.mustache", packagePath(), "__init__.py")); + supportingFiles.add(new SupportingFile("tox.mustache", "", "tox.ini")); } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientCodegen.java index 4538ee1b5f20..1ff48c88da60 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientCodegen.java @@ -40,6 +40,8 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig public static final String PACKAGE_URL = "packageUrl"; public static final String DEFAULT_LIBRARY = "urllib3"; + // nose is a python testing framework, we use pytest if USE_NOSE is unset + public static final String USE_NOSE = "useNose"; protected String packageName = "openapi_client"; protected String packageVersion = "1.0.0"; @@ -47,6 +49,7 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig protected String packageUrl; protected String apiDocPath = "docs/"; protected String modelDocPath = "docs/"; + protected boolean useNose = Boolean.FALSE; protected Map regexModifiers; @@ -127,7 +130,7 @@ public PythonClientCodegen() { "and", "del", "from", "not", "while", "as", "elif", "global", "or", "with", "assert", "else", "if", "pass", "yield", "break", "except", "import", "print", "class", "exec", "in", "raise", "continue", "finally", "is", - "return", "def", "for", "lambda", "try", "self", "nonlocal", "None", "True", + "return", "def", "for", "lambda", "try", "self", "nonlocal", "None", "True", "False", "async", "await")); regexModifiers = new HashMap(); @@ -151,6 +154,8 @@ public PythonClientCodegen() { .defaultValue(Boolean.TRUE.toString())); cliOptions.add(new CliOption(CodegenConstants.SOURCECODEONLY_GENERATION, CodegenConstants.SOURCECODEONLY_GENERATION_DESC) .defaultValue(Boolean.FALSE.toString())); + cliOptions.add(CliOption.newBoolean(USE_NOSE, "use the nose test framework"). + defaultValue(Boolean.FALSE.toString())); supportedLibraries.put("urllib3", "urllib3-based client"); supportedLibraries.put("asyncio", "Asyncio-based client (python 3.5+)"); @@ -190,7 +195,7 @@ public void processOpts() { if (additionalProperties.containsKey(CodegenConstants.PACKAGE_VERSION)) { setPackageVersion((String) additionalProperties.get(CodegenConstants.PACKAGE_VERSION)); - } + } Boolean generateSourceCodeOnly = false; if (additionalProperties.containsKey(CodegenConstants.SOURCECODEONLY_GENERATION)) { @@ -216,6 +221,10 @@ public void processOpts() { setPackageUrl((String) additionalProperties.get(PACKAGE_URL)); } + if (additionalProperties.containsKey(USE_NOSE)) { + setUseNose((String) additionalProperties.get(USE_NOSE)); + } + String readmePath = "README.md"; String readmeTemplate = "README.mustache"; if (generateSourceCodeOnly) { @@ -579,6 +588,10 @@ public void setPackageName(String packageName) { this.packageName = packageName; } + public void setUseNose(String val) { + this.useNose = Boolean.valueOf(val); + } + public void setProjectName(String projectName) { this.projectName = projectName; } diff --git a/modules/openapi-generator/src/main/resources/python-aiohttp/test-requirements.mustache b/modules/openapi-generator/src/main/resources/python-aiohttp/test-requirements.mustache index 1cb425f65519..16ba4a48111d 100644 --- a/modules/openapi-generator/src/main/resources/python-aiohttp/test-requirements.mustache +++ b/modules/openapi-generator/src/main/resources/python-aiohttp/test-requirements.mustache @@ -1,6 +1,13 @@ +{{#useNose}} coverage>=4.0.3 -pytest>=1.3.7 +nose>=1.3.7 pluggy>=0.3.1 py>=1.4.31 randomize>=0.13 +{{/useNose}} +{{^useNose}} +pytest~=4.6.7 # needed for python 2.7+3.4 +pytest-cov>=2.8.1 +pytest-randomly==1.2.3 # needed for python 2.7+3.4 pytest-aiohttp>=0.3.0 +{{/useNose}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/python-aiohttp/tox.mustache b/modules/openapi-generator/src/main/resources/python-aiohttp/tox.mustache new file mode 100644 index 000000000000..58e9f8ff6f5e --- /dev/null +++ b/modules/openapi-generator/src/main/resources/python-aiohttp/tox.mustache @@ -0,0 +1,9 @@ +[tox] +envlist = py3 + +[testenv] +deps=-r{toxinidir}/requirements.txt + -r{toxinidir}/test-requirements.txt + +commands= + {{^useNose}}pytest --cov={{{packageName}}}{{/useNose}}{{#useNose}}nosetests{{/useNose}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/python-blueplanet/app/gitignore.mustache b/modules/openapi-generator/src/main/resources/python-blueplanet/app/gitignore.mustache index a655050c2631..a77a0ebd1660 100644 --- a/modules/openapi-generator/src/main/resources/python-blueplanet/app/gitignore.mustache +++ b/modules/openapi-generator/src/main/resources/python-blueplanet/app/gitignore.mustache @@ -46,6 +46,7 @@ coverage.xml .hypothesis/ venv/ .python-version +.pytest_cache # Translations *.mo diff --git a/modules/openapi-generator/src/main/resources/python-blueplanet/app/test-requirements.mustache b/modules/openapi-generator/src/main/resources/python-blueplanet/app/test-requirements.mustache index 7f8d96e6b40e..efad5423cb5e 100644 --- a/modules/openapi-generator/src/main/resources/python-blueplanet/app/test-requirements.mustache +++ b/modules/openapi-generator/src/main/resources/python-blueplanet/app/test-requirements.mustache @@ -1,6 +1,13 @@ -flask_testing==0.6.1 +{{#useNose}} coverage>=4.0.3 nose>=1.3.7 pluggy>=0.3.1 py>=1.4.31 randomize>=0.13 +{{/useNose}} +{{^useNose}} +pytest~=4.6.7 # needed for python 2.7+3.4 +pytest-cov>=2.8.1 +pytest-randomly==1.2.3 # needed for python 2.7+3.4 +{{/useNose}} +flask_testing==0.6.1 \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/python-blueplanet/app/tox.mustache b/modules/openapi-generator/src/main/resources/python-blueplanet/app/tox.mustache index 3efa994317d9..7b3246c36e25 100644 --- a/modules/openapi-generator/src/main/resources/python-blueplanet/app/tox.mustache +++ b/modules/openapi-generator/src/main/resources/python-blueplanet/app/tox.mustache @@ -6,5 +6,4 @@ deps=-r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt commands= - nosetests \ - [] \ No newline at end of file + {{^useNose}}pytest --cov={{{packageName}}}{{/useNose}}{{#useNose}}nosetests{{/useNose}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/python-flask/gitignore.mustache b/modules/openapi-generator/src/main/resources/python-flask/gitignore.mustache index a655050c2631..43995bd42fa2 100644 --- a/modules/openapi-generator/src/main/resources/python-flask/gitignore.mustache +++ b/modules/openapi-generator/src/main/resources/python-flask/gitignore.mustache @@ -45,7 +45,9 @@ coverage.xml *,cover .hypothesis/ venv/ +.venv/ .python-version +.pytest_cache # Translations *.mo diff --git a/modules/openapi-generator/src/main/resources/python-flask/requirements.mustache b/modules/openapi-generator/src/main/resources/python-flask/requirements.mustache index b5a702d5de84..921d67d029a2 100644 --- a/modules/openapi-generator/src/main/resources/python-flask/requirements.mustache +++ b/modules/openapi-generator/src/main/resources/python-flask/requirements.mustache @@ -1,4 +1,7 @@ -connexion >= 2.0.2 +connexion >= 2.5.0; python_version>="3.6" +connexion >= 2.3.0; python_version=="3.5" +connexion >= 2.3.0; python_version=="3.4" +connexion == 2.4.0; python_version<="2.7" swagger-ui-bundle >= 0.0.2 python_dateutil >= 2.6.0 {{#supportPython2}} diff --git a/modules/openapi-generator/src/main/resources/python-flask/test-requirements.mustache b/modules/openapi-generator/src/main/resources/python-flask/test-requirements.mustache index 7f8d96e6b40e..efad5423cb5e 100644 --- a/modules/openapi-generator/src/main/resources/python-flask/test-requirements.mustache +++ b/modules/openapi-generator/src/main/resources/python-flask/test-requirements.mustache @@ -1,6 +1,13 @@ -flask_testing==0.6.1 +{{#useNose}} coverage>=4.0.3 nose>=1.3.7 pluggy>=0.3.1 py>=1.4.31 randomize>=0.13 +{{/useNose}} +{{^useNose}} +pytest~=4.6.7 # needed for python 2.7+3.4 +pytest-cov>=2.8.1 +pytest-randomly==1.2.3 # needed for python 2.7+3.4 +{{/useNose}} +flask_testing==0.6.1 \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/python-flask/tox.mustache b/modules/openapi-generator/src/main/resources/python-flask/tox.mustache index 1195b3391b0b..7fcd185a8d82 100644 --- a/modules/openapi-generator/src/main/resources/python-flask/tox.mustache +++ b/modules/openapi-generator/src/main/resources/python-flask/tox.mustache @@ -6,5 +6,4 @@ deps=-r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt commands= - nosetests \ - [] \ No newline at end of file + {{^useNose}}pytest --cov={{{packageName}}}{{/useNose}}{{#useNose}}nosetests{{/useNose}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/python/gitignore.mustache b/modules/openapi-generator/src/main/resources/python/gitignore.mustache index a655050c2631..43995bd42fa2 100644 --- a/modules/openapi-generator/src/main/resources/python/gitignore.mustache +++ b/modules/openapi-generator/src/main/resources/python/gitignore.mustache @@ -45,7 +45,9 @@ coverage.xml *,cover .hypothesis/ venv/ +.venv/ .python-version +.pytest_cache # Translations *.mo diff --git a/modules/openapi-generator/src/main/resources/python/python-experimental/test-requirements.mustache b/modules/openapi-generator/src/main/resources/python/python-experimental/test-requirements.mustache index 023ff960788a..338b229bae51 100644 --- a/modules/openapi-generator/src/main/resources/python/python-experimental/test-requirements.mustache +++ b/modules/openapi-generator/src/main/resources/python/python-experimental/test-requirements.mustache @@ -1,13 +1,13 @@ -{{^asyncio}} +{{#useNose}} coverage>=4.0.3 nose>=1.3.7 -{{/asyncio}} -{{#asyncio}} -pytest>=3.6.0 -pytest-cov>=2.6.1 -{{/asyncio}} pluggy>=0.3.1 py>=1.4.31 randomize>=0.13 -mock; python_version<="2.7" - +{{/useNose}} +{{^useNose}} +pytest~=4.6.7 # needed for python 2.7+3.4 +pytest-cov>=2.8.1 +pytest-randomly==1.2.3 # needed for python 2.7+3.4 +{{/useNose}} +mock; python_version<="2.7" \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/python/test-requirements.mustache b/modules/openapi-generator/src/main/resources/python/test-requirements.mustache index d9e3f20b5369..12021b47a1c2 100644 --- a/modules/openapi-generator/src/main/resources/python/test-requirements.mustache +++ b/modules/openapi-generator/src/main/resources/python/test-requirements.mustache @@ -1,11 +1,12 @@ -{{^asyncio}} +{{#useNose}} coverage>=4.0.3 nose>=1.3.7 -{{/asyncio}} -{{#asyncio}} -pytest>=3.6.0 -pytest-cov>=2.6.1 -{{/asyncio}} pluggy>=0.3.1 py>=1.4.31 randomize>=0.13 +{{/useNose}} +{{^useNose}} +pytest~=4.6.7 # needed for python 2.7+3.4 +pytest-cov>=2.8.1 +pytest-randomly==1.2.3 # needed for python 2.7+3.4 +{{/useNose}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/python/tox.mustache b/modules/openapi-generator/src/main/resources/python/tox.mustache index 585feb3c681b..fe989faf9302 100644 --- a/modules/openapi-generator/src/main/resources/python/tox.mustache +++ b/modules/openapi-generator/src/main/resources/python/tox.mustache @@ -11,10 +11,4 @@ deps=-r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt commands= -{{^asyncio}} - nosetests \ - [] -{{/asyncio}} -{{#asyncio}} - pytest -v --cov {{{packageName}}} -{{/asyncio}} + {{^useNose}}pytest --cov={{{packageName}}}{{/useNose}}{{#useNose}}nosetests{{/useNose}} diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/PythonClientOptionsProvider.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/PythonClientOptionsProvider.java index f74b17266ce3..d3afcc8f8448 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/PythonClientOptionsProvider.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/PythonClientOptionsProvider.java @@ -28,6 +28,7 @@ public class PythonClientOptionsProvider implements OptionsProvider { public static final String PROJECT_NAME_VALUE = "swagger-client-python"; public static final String PACKAGE_VERSION_VALUE = "1.0.0-SNAPSHOT"; public static final String PACKAGE_URL_VALUE = ""; + public static final String USE_NOSE_VALUE = "false"; @Override public String getLanguage() { @@ -45,6 +46,7 @@ public Map createOptions() { .put(CodegenConstants.HIDE_GENERATION_TIMESTAMP, "true") .put(CodegenConstants.SOURCECODEONLY_GENERATION, "false") .put(CodegenConstants.LIBRARY, "urllib3") + .put(PythonClientCodegen.USE_NOSE, USE_NOSE_VALUE) .build(); } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/python/PythonClientOptionsTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/python/PythonClientOptionsTest.java index 47d59ba78c4f..ce9d564f4701 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/python/PythonClientOptionsTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/python/PythonClientOptionsTest.java @@ -56,6 +56,9 @@ protected void setExpectations() { clientCodegen.setPackageUrl(PythonClientOptionsProvider.PACKAGE_URL_VALUE); times = 1; + clientCodegen.setUseNose(PythonClientOptionsProvider.USE_NOSE_VALUE); + times = 1; + clientCodegen.packagePath(); result = PythonClientOptionsProvider.PACKAGE_NAME_VALUE.replace('.', File.separatorChar); minTimes = 1; diff --git a/samples/client/petstore/python-asyncio/.gitignore b/samples/client/petstore/python-asyncio/.gitignore index a655050c2631..43995bd42fa2 100644 --- a/samples/client/petstore/python-asyncio/.gitignore +++ b/samples/client/petstore/python-asyncio/.gitignore @@ -45,7 +45,9 @@ coverage.xml *,cover .hypothesis/ venv/ +.venv/ .python-version +.pytest_cache # Translations *.mo diff --git a/samples/client/petstore/python-asyncio/dev-requirements.txt b/samples/client/petstore/python-asyncio/dev-requirements.txt index 49182426e202..ccdfca629494 100644 --- a/samples/client/petstore/python-asyncio/dev-requirements.txt +++ b/samples/client/petstore/python-asyncio/dev-requirements.txt @@ -1,4 +1,2 @@ tox -coverage -randomize flake8 diff --git a/samples/client/petstore/python-asyncio/test-requirements.txt b/samples/client/petstore/python-asyncio/test-requirements.txt index 600ac897bb74..4ed3991cbec1 100644 --- a/samples/client/petstore/python-asyncio/test-requirements.txt +++ b/samples/client/petstore/python-asyncio/test-requirements.txt @@ -1,5 +1,3 @@ -pytest>=3.6.0 -pytest-cov>=2.6.1 -pluggy>=0.3.1 -py>=1.4.31 -randomize>=0.13 +pytest~=4.6.7 # needed for python 2.7+3.4 +pytest-cov>=2.8.1 +pytest-randomly==1.2.3 # needed for python 2.7+3.4 diff --git a/samples/client/petstore/python-asyncio/test_python3.sh b/samples/client/petstore/python-asyncio/test_python3.sh index 9160e25714ad..1a8e712f73c5 100755 --- a/samples/client/petstore/python-asyncio/test_python3.sh +++ b/samples/client/petstore/python-asyncio/test_python3.sh @@ -18,7 +18,6 @@ fi ### install dependencies pip install -r $REQUIREMENTS_FILE | tee -a $REQUIREMENTS_OUT -python setup.py develop ### run tests tox || exit 1 diff --git a/samples/client/petstore/python-asyncio/tox.ini b/samples/client/petstore/python-asyncio/tox.ini index 65f5351ddcc3..b11bda70e648 100644 --- a/samples/client/petstore/python-asyncio/tox.ini +++ b/samples/client/petstore/python-asyncio/tox.ini @@ -6,4 +6,4 @@ deps=-r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt commands= - pytest -v --cov petstore_api + pytest --cov=petstore_api \ No newline at end of file diff --git a/samples/client/petstore/python-experimental/.gitignore b/samples/client/petstore/python-experimental/.gitignore index a655050c2631..43995bd42fa2 100644 --- a/samples/client/petstore/python-experimental/.gitignore +++ b/samples/client/petstore/python-experimental/.gitignore @@ -45,7 +45,9 @@ coverage.xml *,cover .hypothesis/ venv/ +.venv/ .python-version +.pytest_cache # Translations *.mo diff --git a/samples/client/petstore/python-experimental/dev-requirements.txt b/samples/client/petstore/python-experimental/dev-requirements.txt index f50c13b5c503..ccdfca629494 100644 --- a/samples/client/petstore/python-experimental/dev-requirements.txt +++ b/samples/client/petstore/python-experimental/dev-requirements.txt @@ -1,5 +1,2 @@ -nose tox -coverage -randomize flake8 diff --git a/samples/client/petstore/python-experimental/pom.xml b/samples/client/petstore/python-experimental/pom.xml index 3c9463331861..742451c23b2f 100644 --- a/samples/client/petstore/python-experimental/pom.xml +++ b/samples/client/petstore/python-experimental/pom.xml @@ -27,7 +27,7 @@ 1.2.1 - nose-test + test integration-test exec diff --git a/samples/client/petstore/python-experimental/setup.cfg b/samples/client/petstore/python-experimental/setup.cfg index 26b7a359d580..11433ee875ab 100644 --- a/samples/client/petstore/python-experimental/setup.cfg +++ b/samples/client/petstore/python-experimental/setup.cfg @@ -1,11 +1,2 @@ -[nosetests] -logging-clear-handlers=true -verbosity=2 -randomize=true -exe=true -with-coverage=true -cover-package=petstore_api -cover-erase=true - [flake8] max-line-length=99 diff --git a/samples/client/petstore/python-experimental/test-requirements.txt b/samples/client/petstore/python-experimental/test-requirements.txt index 5816b8749532..06f7754d2044 100644 --- a/samples/client/petstore/python-experimental/test-requirements.txt +++ b/samples/client/petstore/python-experimental/test-requirements.txt @@ -1,7 +1,4 @@ -coverage>=4.0.3 -nose>=1.3.7 -pluggy>=0.3.1 -py>=1.4.31 -randomize>=0.13 -mock; python_version<="2.7" - +pytest~=4.6.7 # needed for python 2.7+3.4 +pytest-cov>=2.8.1 +pytest-randomly==1.2.3 # needed for python 2.7+3.4 +mock; python_version<="2.7" \ No newline at end of file diff --git a/samples/client/petstore/python-experimental/test_python2.sh b/samples/client/petstore/python-experimental/test_python2.sh index 35de07deec71..b2f344ec8977 100644 --- a/samples/client/petstore/python-experimental/test_python2.sh +++ b/samples/client/petstore/python-experimental/test_python2.sh @@ -19,11 +19,9 @@ fi ### install dependencies pip install -r $REQUIREMENTS_FILE | tee -a $REQUIREMENTS_OUT -pip install -r test-requirements.txt -python setup.py develop ### run tests -nosetests || exit 1 +tox -e py27 || exit 1 ### static analysis of code flake8 --show-source petstore_api/ diff --git a/samples/client/petstore/python-experimental/test_python2_and_3.sh b/samples/client/petstore/python-experimental/test_python2_and_3.sh index 8511d46cd795..3205dfd07da9 100644 --- a/samples/client/petstore/python-experimental/test_python2_and_3.sh +++ b/samples/client/petstore/python-experimental/test_python2_and_3.sh @@ -18,7 +18,6 @@ fi ### install dependencies pip install -r $REQUIREMENTS_FILE | tee -a $REQUIREMENTS_OUT -python setup.py develop ### run tests tox || exit 1 diff --git a/samples/client/petstore/python-experimental/tox.ini b/samples/client/petstore/python-experimental/tox.ini index 3d0be613cfc7..2e5fc503d039 100644 --- a/samples/client/petstore/python-experimental/tox.ini +++ b/samples/client/petstore/python-experimental/tox.ini @@ -6,5 +6,4 @@ deps=-r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt commands= - nosetests \ - [] + pytest --cov=petstore_api \ No newline at end of file diff --git a/samples/client/petstore/python-tornado/.gitignore b/samples/client/petstore/python-tornado/.gitignore index a655050c2631..43995bd42fa2 100644 --- a/samples/client/petstore/python-tornado/.gitignore +++ b/samples/client/petstore/python-tornado/.gitignore @@ -45,7 +45,9 @@ coverage.xml *,cover .hypothesis/ venv/ +.venv/ .python-version +.pytest_cache # Translations *.mo diff --git a/samples/client/petstore/python-tornado/dev-requirements.txt b/samples/client/petstore/python-tornado/dev-requirements.txt index f50c13b5c503..ccdfca629494 100644 --- a/samples/client/petstore/python-tornado/dev-requirements.txt +++ b/samples/client/petstore/python-tornado/dev-requirements.txt @@ -1,5 +1,2 @@ -nose tox -coverage -randomize flake8 diff --git a/samples/client/petstore/python-tornado/pom.xml b/samples/client/petstore/python-tornado/pom.xml index 821e12dfe8d3..9aae57304fc7 100644 --- a/samples/client/petstore/python-tornado/pom.xml +++ b/samples/client/petstore/python-tornado/pom.xml @@ -27,7 +27,7 @@ 1.2.1 - nose-test + test integration-test exec diff --git a/samples/client/petstore/python-tornado/test-requirements.txt b/samples/client/petstore/python-tornado/test-requirements.txt index 2702246c0e6f..4ed3991cbec1 100644 --- a/samples/client/petstore/python-tornado/test-requirements.txt +++ b/samples/client/petstore/python-tornado/test-requirements.txt @@ -1,5 +1,3 @@ -coverage>=4.0.3 -nose>=1.3.7 -pluggy>=0.3.1 -py>=1.4.31 -randomize>=0.13 +pytest~=4.6.7 # needed for python 2.7+3.4 +pytest-cov>=2.8.1 +pytest-randomly==1.2.3 # needed for python 2.7+3.4 diff --git a/samples/client/petstore/python-tornado/test_python2_and_3.sh b/samples/client/petstore/python-tornado/test_python2_and_3.sh index 7b5795ec24a9..3118c449124d 100755 --- a/samples/client/petstore/python-tornado/test_python2_and_3.sh +++ b/samples/client/petstore/python-tornado/test_python2_and_3.sh @@ -18,7 +18,6 @@ fi ### install dependencies pip install -r $REQUIREMENTS_FILE | tee -a $REQUIREMENTS_OUT -python setup.py develop ### run tests tox || exit 1 diff --git a/samples/client/petstore/python-tornado/tox.ini b/samples/client/petstore/python-tornado/tox.ini index 3d0be613cfc7..2e5fc503d039 100644 --- a/samples/client/petstore/python-tornado/tox.ini +++ b/samples/client/petstore/python-tornado/tox.ini @@ -6,5 +6,4 @@ deps=-r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt commands= - nosetests \ - [] + pytest --cov=petstore_api \ No newline at end of file diff --git a/samples/client/petstore/python/.gitignore b/samples/client/petstore/python/.gitignore index a655050c2631..43995bd42fa2 100644 --- a/samples/client/petstore/python/.gitignore +++ b/samples/client/petstore/python/.gitignore @@ -45,7 +45,9 @@ coverage.xml *,cover .hypothesis/ venv/ +.venv/ .python-version +.pytest_cache # Translations *.mo diff --git a/samples/client/petstore/python/dev-requirements.txt b/samples/client/petstore/python/dev-requirements.txt index f50c13b5c503..ccdfca629494 100644 --- a/samples/client/petstore/python/dev-requirements.txt +++ b/samples/client/petstore/python/dev-requirements.txt @@ -1,5 +1,2 @@ -nose tox -coverage -randomize flake8 diff --git a/samples/client/petstore/python/pom.xml b/samples/client/petstore/python/pom.xml index db2d09246c3b..71814d4388d9 100644 --- a/samples/client/petstore/python/pom.xml +++ b/samples/client/petstore/python/pom.xml @@ -27,7 +27,7 @@ 1.2.1 - nose-test + test integration-test exec diff --git a/samples/client/petstore/python/setup.cfg b/samples/client/petstore/python/setup.cfg index 26b7a359d580..11433ee875ab 100644 --- a/samples/client/petstore/python/setup.cfg +++ b/samples/client/petstore/python/setup.cfg @@ -1,11 +1,2 @@ -[nosetests] -logging-clear-handlers=true -verbosity=2 -randomize=true -exe=true -with-coverage=true -cover-package=petstore_api -cover-erase=true - [flake8] max-line-length=99 diff --git a/samples/client/petstore/python/test-requirements.txt b/samples/client/petstore/python/test-requirements.txt index 2702246c0e6f..4ed3991cbec1 100644 --- a/samples/client/petstore/python/test-requirements.txt +++ b/samples/client/petstore/python/test-requirements.txt @@ -1,5 +1,3 @@ -coverage>=4.0.3 -nose>=1.3.7 -pluggy>=0.3.1 -py>=1.4.31 -randomize>=0.13 +pytest~=4.6.7 # needed for python 2.7+3.4 +pytest-cov>=2.8.1 +pytest-randomly==1.2.3 # needed for python 2.7+3.4 diff --git a/samples/client/petstore/python/test_python2.sh b/samples/client/petstore/python/test_python2.sh index fb0eaed6ffa0..4c9488a33297 100755 --- a/samples/client/petstore/python/test_python2.sh +++ b/samples/client/petstore/python/test_python2.sh @@ -11,17 +11,16 @@ export LANG=en_US.UTF-8 ### set virtualenv if [ -z "$VIRTUAL_ENV" ]; then - virtualenv $VENV --no-site-packages --always-copy + virtualenv $VENV --no-site-packages --always-copy --python python source $VENV/bin/activate DEACTIVE=true fi ### install dependencies pip install -r $REQUIREMENTS_FILE | tee -a $REQUIREMENTS_OUT -python setup.py develop ### run tests -nosetests || exit 1 +tox -e py27 || exit 1 ### static analysis of code flake8 --show-source petstore_api/ @@ -30,4 +29,3 @@ flake8 --show-source petstore_api/ #if [ $DEACTIVE == true ]; then # deactivate #fi - diff --git a/samples/client/petstore/python/test_python2_and_3.sh b/samples/client/petstore/python/test_python2_and_3.sh index 7b5795ec24a9..3118c449124d 100755 --- a/samples/client/petstore/python/test_python2_and_3.sh +++ b/samples/client/petstore/python/test_python2_and_3.sh @@ -18,7 +18,6 @@ fi ### install dependencies pip install -r $REQUIREMENTS_FILE | tee -a $REQUIREMENTS_OUT -python setup.py develop ### run tests tox || exit 1 diff --git a/samples/client/petstore/python/tests/test_pet_api.py b/samples/client/petstore/python/tests/test_pet_api.py index 80d34f6b5f21..b7650f042eb9 100644 --- a/samples/client/petstore/python/tests/test_pet_api.py +++ b/samples/client/petstore/python/tests/test_pet_api.py @@ -157,7 +157,7 @@ def test_async_with_result(self): response = thread.get() response2 = thread2.get() - self.assertEquals(response.id, self.pet.id) + self.assertEqual(response.id, self.pet.id) self.assertIsNotNone(response2.id, self.pet.id) def test_async_with_http_info(self): @@ -167,7 +167,7 @@ def test_async_with_http_info(self): data, status, headers = thread.get() self.assertIsInstance(data, petstore_api.Pet) - self.assertEquals(status, 200) + self.assertEqual(status, 200) def test_async_exception(self): self.pet_api.add_pet(self.pet) diff --git a/samples/client/petstore/python/tox.ini b/samples/client/petstore/python/tox.ini index 3d0be613cfc7..2e5fc503d039 100644 --- a/samples/client/petstore/python/tox.ini +++ b/samples/client/petstore/python/tox.ini @@ -6,5 +6,4 @@ deps=-r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt commands= - nosetests \ - [] + pytest --cov=petstore_api \ No newline at end of file diff --git a/samples/openapi3/client/petstore/python/.gitignore b/samples/openapi3/client/petstore/python/.gitignore index a655050c2631..43995bd42fa2 100644 --- a/samples/openapi3/client/petstore/python/.gitignore +++ b/samples/openapi3/client/petstore/python/.gitignore @@ -45,7 +45,9 @@ coverage.xml *,cover .hypothesis/ venv/ +.venv/ .python-version +.pytest_cache # Translations *.mo diff --git a/samples/openapi3/client/petstore/python/dev-requirements.txt b/samples/openapi3/client/petstore/python/dev-requirements.txt new file mode 100644 index 000000000000..ccdfca629494 --- /dev/null +++ b/samples/openapi3/client/petstore/python/dev-requirements.txt @@ -0,0 +1,2 @@ +tox +flake8 diff --git a/samples/openapi3/client/petstore/python/pom.xml b/samples/openapi3/client/petstore/python/pom.xml index 2fa7d0a113f9..98955483eb8f 100644 --- a/samples/openapi3/client/petstore/python/pom.xml +++ b/samples/openapi3/client/petstore/python/pom.xml @@ -27,7 +27,7 @@ 1.2.1 - nose-test + test integration-test exec diff --git a/samples/openapi3/client/petstore/python/test-requirements.txt b/samples/openapi3/client/petstore/python/test-requirements.txt index 2702246c0e6f..4ed3991cbec1 100644 --- a/samples/openapi3/client/petstore/python/test-requirements.txt +++ b/samples/openapi3/client/petstore/python/test-requirements.txt @@ -1,5 +1,3 @@ -coverage>=4.0.3 -nose>=1.3.7 -pluggy>=0.3.1 -py>=1.4.31 -randomize>=0.13 +pytest~=4.6.7 # needed for python 2.7+3.4 +pytest-cov>=2.8.1 +pytest-randomly==1.2.3 # needed for python 2.7+3.4 diff --git a/samples/openapi3/client/petstore/python/test_python2.sh b/samples/openapi3/client/petstore/python/test_python2.sh index fb0eaed6ffa0..24c3cbdd4960 100644 --- a/samples/openapi3/client/petstore/python/test_python2.sh +++ b/samples/openapi3/client/petstore/python/test_python2.sh @@ -18,10 +18,9 @@ fi ### install dependencies pip install -r $REQUIREMENTS_FILE | tee -a $REQUIREMENTS_OUT -python setup.py develop ### run tests -nosetests || exit 1 +tox -e py27 || exit 1 ### static analysis of code flake8 --show-source petstore_api/ diff --git a/samples/openapi3/client/petstore/python/test_python2_and_3.sh b/samples/openapi3/client/petstore/python/test_python2_and_3.sh index daf08d5bacba..ab02e6e40809 100644 --- a/samples/openapi3/client/petstore/python/test_python2_and_3.sh +++ b/samples/openapi3/client/petstore/python/test_python2_and_3.sh @@ -18,7 +18,6 @@ fi ### install dependencies pip install -r $REQUIREMENTS_FILE | tee -a $REQUIREMENTS_OUT -python setup.py develop ### run tests tox || exit 1 diff --git a/samples/openapi3/client/petstore/python/tox.ini b/samples/openapi3/client/petstore/python/tox.ini index 3d0be613cfc7..2e5fc503d039 100644 --- a/samples/openapi3/client/petstore/python/tox.ini +++ b/samples/openapi3/client/petstore/python/tox.ini @@ -6,5 +6,4 @@ deps=-r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt commands= - nosetests \ - [] + pytest --cov=petstore_api \ No newline at end of file diff --git a/samples/openapi3/server/petstore/python-flask-python2/.gitignore b/samples/openapi3/server/petstore/python-flask-python2/.gitignore index a655050c2631..43995bd42fa2 100644 --- a/samples/openapi3/server/petstore/python-flask-python2/.gitignore +++ b/samples/openapi3/server/petstore/python-flask-python2/.gitignore @@ -45,7 +45,9 @@ coverage.xml *,cover .hypothesis/ venv/ +.venv/ .python-version +.pytest_cache # Translations *.mo diff --git a/samples/openapi3/server/petstore/python-flask-python2/requirements.txt b/samples/openapi3/server/petstore/python-flask-python2/requirements.txt index bc5357066229..5c5ce2a1a269 100644 --- a/samples/openapi3/server/petstore/python-flask-python2/requirements.txt +++ b/samples/openapi3/server/petstore/python-flask-python2/requirements.txt @@ -1,4 +1,7 @@ -connexion >= 2.0.2 +connexion >= 2.5.0; python_version>="3.6" +connexion >= 2.3.0; python_version=="3.5" +connexion >= 2.3.0; python_version=="3.4" +connexion == 2.4.0; python_version<="2.7" swagger-ui-bundle >= 0.0.2 python_dateutil >= 2.6.0 typing >= 3.5.2.2 diff --git a/samples/openapi3/server/petstore/python-flask-python2/test-requirements.txt b/samples/openapi3/server/petstore/python-flask-python2/test-requirements.txt index 7f8d96e6b40e..a2626d875ff4 100644 --- a/samples/openapi3/server/petstore/python-flask-python2/test-requirements.txt +++ b/samples/openapi3/server/petstore/python-flask-python2/test-requirements.txt @@ -1,6 +1,4 @@ -flask_testing==0.6.1 -coverage>=4.0.3 -nose>=1.3.7 -pluggy>=0.3.1 -py>=1.4.31 -randomize>=0.13 +pytest~=4.6.7 # needed for python 2.7+3.4 +pytest-cov>=2.8.1 +pytest-randomly==1.2.3 # needed for python 2.7+3.4 +flask_testing==0.6.1 \ No newline at end of file diff --git a/samples/openapi3/server/petstore/python-flask-python2/tox.ini b/samples/openapi3/server/petstore/python-flask-python2/tox.ini index 26985414c882..d05c607610ce 100644 --- a/samples/openapi3/server/petstore/python-flask-python2/tox.ini +++ b/samples/openapi3/server/petstore/python-flask-python2/tox.ini @@ -6,5 +6,4 @@ deps=-r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt commands= - nosetests \ - [] \ No newline at end of file + pytest --cov=openapi_server \ No newline at end of file diff --git a/samples/openapi3/server/petstore/python-flask/.gitignore b/samples/openapi3/server/petstore/python-flask/.gitignore index a655050c2631..43995bd42fa2 100644 --- a/samples/openapi3/server/petstore/python-flask/.gitignore +++ b/samples/openapi3/server/petstore/python-flask/.gitignore @@ -45,7 +45,9 @@ coverage.xml *,cover .hypothesis/ venv/ +.venv/ .python-version +.pytest_cache # Translations *.mo diff --git a/samples/openapi3/server/petstore/python-flask/requirements.txt b/samples/openapi3/server/petstore/python-flask/requirements.txt index 1a01b5804905..029a9dae4cdf 100644 --- a/samples/openapi3/server/petstore/python-flask/requirements.txt +++ b/samples/openapi3/server/petstore/python-flask/requirements.txt @@ -1,4 +1,7 @@ -connexion >= 2.0.2 +connexion >= 2.5.0; python_version>="3.6" +connexion >= 2.3.0; python_version=="3.5" +connexion >= 2.3.0; python_version=="3.4" +connexion == 2.4.0; python_version<="2.7" swagger-ui-bundle >= 0.0.2 python_dateutil >= 2.6.0 setuptools >= 21.0.0 diff --git a/samples/openapi3/server/petstore/python-flask/test-requirements.txt b/samples/openapi3/server/petstore/python-flask/test-requirements.txt index 7f8d96e6b40e..a2626d875ff4 100644 --- a/samples/openapi3/server/petstore/python-flask/test-requirements.txt +++ b/samples/openapi3/server/petstore/python-flask/test-requirements.txt @@ -1,6 +1,4 @@ -flask_testing==0.6.1 -coverage>=4.0.3 -nose>=1.3.7 -pluggy>=0.3.1 -py>=1.4.31 -randomize>=0.13 +pytest~=4.6.7 # needed for python 2.7+3.4 +pytest-cov>=2.8.1 +pytest-randomly==1.2.3 # needed for python 2.7+3.4 +flask_testing==0.6.1 \ No newline at end of file diff --git a/samples/openapi3/server/petstore/python-flask/tox.ini b/samples/openapi3/server/petstore/python-flask/tox.ini index ab4dfbb81b8b..cff71191e6cb 100644 --- a/samples/openapi3/server/petstore/python-flask/tox.ini +++ b/samples/openapi3/server/petstore/python-flask/tox.ini @@ -6,5 +6,4 @@ deps=-r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt commands= - nosetests \ - [] \ No newline at end of file + pytest --cov=openapi_server \ No newline at end of file diff --git a/samples/server/petstore/python-aiohttp/dev-requirements.txt b/samples/server/petstore/python-aiohttp/dev-requirements.txt new file mode 100644 index 000000000000..ccdfca629494 --- /dev/null +++ b/samples/server/petstore/python-aiohttp/dev-requirements.txt @@ -0,0 +1,2 @@ +tox +flake8 diff --git a/samples/server/petstore/python-aiohttp/pom.xml b/samples/server/petstore/python-aiohttp/pom.xml index 8e77233a458b..26c4b7c492d1 100644 --- a/samples/server/petstore/python-aiohttp/pom.xml +++ b/samples/server/petstore/python-aiohttp/pom.xml @@ -27,7 +27,7 @@ 1.2.1 - pytest-test + test integration-test exec diff --git a/samples/server/petstore/python-aiohttp/test-requirements.txt b/samples/server/petstore/python-aiohttp/test-requirements.txt index 1cb425f65519..31b28baaf284 100644 --- a/samples/server/petstore/python-aiohttp/test-requirements.txt +++ b/samples/server/petstore/python-aiohttp/test-requirements.txt @@ -1,6 +1,4 @@ -coverage>=4.0.3 -pytest>=1.3.7 -pluggy>=0.3.1 -py>=1.4.31 -randomize>=0.13 +pytest~=4.6.7 # needed for python 2.7+3.4 +pytest-cov>=2.8.1 +pytest-randomly==1.2.3 # needed for python 2.7+3.4 pytest-aiohttp>=0.3.0 diff --git a/samples/server/petstore/python-aiohttp/test_python3.sh b/samples/server/petstore/python-aiohttp/test_python3.sh index c6a92d00aed2..65d96267d4fb 100755 --- a/samples/server/petstore/python-aiohttp/test_python3.sh +++ b/samples/server/petstore/python-aiohttp/test_python3.sh @@ -1,8 +1,7 @@ #!/bin/bash -REQUIREMENTS_FILE=requirements.txt -TEST_REQUIREMENTS_FILE=test-requirements.txt -REQUIREMENTS_OUT=requirements.txt.log +REQUIREMENTS_FILE=dev-requirements.txt +REQUIREMENTS_OUT=dev-requirements.txt.log SETUP_OUT=*.egg-info VENV=.venv DEACTIVE=false @@ -12,16 +11,16 @@ export LANG=en_US.UTF-8 ### set virtualenv if [ -z "$VIRTUAL_ENV" ]; then - virtualenv $VENV --no-site-packages --always-copy --python python3 + virtualenv $VENV --no-site-packages --always-copy --python python3 source $VENV/bin/activate DEACTIVE=true fi ### install dependencies -pip install -r $REQUIREMENTS_FILE -r $TEST_REQUIREMENTS_FILE | tee -a $REQUIREMENTS_OUT +pip install -r $REQUIREMENTS_FILE | tee -a $REQUIREMENTS_OUT ### run tests -pytest || exit 1 +tox || exit 1 ### static analysis of code flake8 --show-source petstore_api/ diff --git a/samples/server/petstore/python-aiohttp/tox.ini b/samples/server/petstore/python-aiohttp/tox.ini new file mode 100644 index 000000000000..cff71191e6cb --- /dev/null +++ b/samples/server/petstore/python-aiohttp/tox.ini @@ -0,0 +1,9 @@ +[tox] +envlist = py3 + +[testenv] +deps=-r{toxinidir}/requirements.txt + -r{toxinidir}/test-requirements.txt + +commands= + pytest --cov=openapi_server \ No newline at end of file diff --git a/samples/server/petstore/python-blueplanet/.openapi-generator/VERSION b/samples/server/petstore/python-blueplanet/.openapi-generator/VERSION index 0c89fc927e32..58592f031f65 100644 --- a/samples/server/petstore/python-blueplanet/.openapi-generator/VERSION +++ b/samples/server/petstore/python-blueplanet/.openapi-generator/VERSION @@ -1 +1 @@ -4.0.0 \ No newline at end of file +4.2.3-SNAPSHOT \ No newline at end of file diff --git a/samples/server/petstore/python-blueplanet/app/.gitignore b/samples/server/petstore/python-blueplanet/app/.gitignore index a655050c2631..a77a0ebd1660 100644 --- a/samples/server/petstore/python-blueplanet/app/.gitignore +++ b/samples/server/petstore/python-blueplanet/app/.gitignore @@ -46,6 +46,7 @@ coverage.xml .hypothesis/ venv/ .python-version +.pytest_cache # Translations *.mo diff --git a/samples/server/petstore/python-blueplanet/app/test-requirements.txt b/samples/server/petstore/python-blueplanet/app/test-requirements.txt index 7f8d96e6b40e..a2626d875ff4 100644 --- a/samples/server/petstore/python-blueplanet/app/test-requirements.txt +++ b/samples/server/petstore/python-blueplanet/app/test-requirements.txt @@ -1,6 +1,4 @@ -flask_testing==0.6.1 -coverage>=4.0.3 -nose>=1.3.7 -pluggy>=0.3.1 -py>=1.4.31 -randomize>=0.13 +pytest~=4.6.7 # needed for python 2.7+3.4 +pytest-cov>=2.8.1 +pytest-randomly==1.2.3 # needed for python 2.7+3.4 +flask_testing==0.6.1 \ No newline at end of file diff --git a/samples/server/petstore/python-blueplanet/app/tox.ini b/samples/server/petstore/python-blueplanet/app/tox.ini index 3e0b644eec48..d2eb61d57c7e 100644 --- a/samples/server/petstore/python-blueplanet/app/tox.ini +++ b/samples/server/petstore/python-blueplanet/app/tox.ini @@ -6,5 +6,4 @@ deps=-r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt commands= - nosetests \ - [] \ No newline at end of file + pytest --cov=openapi_server \ No newline at end of file diff --git a/samples/server/petstore/python-flask-python2/.gitignore b/samples/server/petstore/python-flask-python2/.gitignore index a655050c2631..43995bd42fa2 100644 --- a/samples/server/petstore/python-flask-python2/.gitignore +++ b/samples/server/petstore/python-flask-python2/.gitignore @@ -45,7 +45,9 @@ coverage.xml *,cover .hypothesis/ venv/ +.venv/ .python-version +.pytest_cache # Translations *.mo diff --git a/samples/server/petstore/python-flask-python2/dev-requirements.txt b/samples/server/petstore/python-flask-python2/dev-requirements.txt new file mode 100644 index 000000000000..ccdfca629494 --- /dev/null +++ b/samples/server/petstore/python-flask-python2/dev-requirements.txt @@ -0,0 +1,2 @@ +tox +flake8 diff --git a/samples/server/petstore/python-flask-python2/pom.xml b/samples/server/petstore/python-flask-python2/pom.xml index 113c387d5f21..430bddf2ed3f 100644 --- a/samples/server/petstore/python-flask-python2/pom.xml +++ b/samples/server/petstore/python-flask-python2/pom.xml @@ -27,7 +27,7 @@ 1.2.1 - nose-test + test integration-test exec diff --git a/samples/server/petstore/python-flask-python2/requirements.txt b/samples/server/petstore/python-flask-python2/requirements.txt index bc5357066229..5c5ce2a1a269 100644 --- a/samples/server/petstore/python-flask-python2/requirements.txt +++ b/samples/server/petstore/python-flask-python2/requirements.txt @@ -1,4 +1,7 @@ -connexion >= 2.0.2 +connexion >= 2.5.0; python_version>="3.6" +connexion >= 2.3.0; python_version=="3.5" +connexion >= 2.3.0; python_version=="3.4" +connexion == 2.4.0; python_version<="2.7" swagger-ui-bundle >= 0.0.2 python_dateutil >= 2.6.0 typing >= 3.5.2.2 diff --git a/samples/server/petstore/python-flask-python2/test-requirements.txt b/samples/server/petstore/python-flask-python2/test-requirements.txt index 7f8d96e6b40e..a2626d875ff4 100644 --- a/samples/server/petstore/python-flask-python2/test-requirements.txt +++ b/samples/server/petstore/python-flask-python2/test-requirements.txt @@ -1,6 +1,4 @@ -flask_testing==0.6.1 -coverage>=4.0.3 -nose>=1.3.7 -pluggy>=0.3.1 -py>=1.4.31 -randomize>=0.13 +pytest~=4.6.7 # needed for python 2.7+3.4 +pytest-cov>=2.8.1 +pytest-randomly==1.2.3 # needed for python 2.7+3.4 +flask_testing==0.6.1 \ No newline at end of file diff --git a/samples/server/petstore/python-flask-python2/test_python2.sh b/samples/server/petstore/python-flask-python2/test_python2.sh index e579f4d7f559..89e56c485dee 100755 --- a/samples/server/petstore/python-flask-python2/test_python2.sh +++ b/samples/server/petstore/python-flask-python2/test_python2.sh @@ -1,7 +1,7 @@ #!/bin/bash -REQUIREMENTS_FILE=test-requirements.txt -REQUIREMENTS_OUT=test-requirements.txt.log +REQUIREMENTS_FILE=dev-requirements.txt +REQUIREMENTS_OUT=dev-requirements.txt.log SETUP_OUT=*.egg-info VENV=.venv DEACTIVE=false @@ -18,15 +18,14 @@ fi ### install dependencies pip install -r $REQUIREMENTS_FILE | tee -a $REQUIREMENTS_OUT -python setup.py develop ### run tests -tox || exit 1 +tox -e py27 || exit 1 ### static analysis of code flake8 --show-source petstore_api/ ### deactivate virtualenv -#if [ $DEACTIVE == true ]; then -# deactivate -#fi +# if [ $DEACTIVE == true ]; then +# deactivate +# fi diff --git a/samples/server/petstore/python-flask-python2/tox.ini b/samples/server/petstore/python-flask-python2/tox.ini index 26985414c882..d05c607610ce 100644 --- a/samples/server/petstore/python-flask-python2/tox.ini +++ b/samples/server/petstore/python-flask-python2/tox.ini @@ -6,5 +6,4 @@ deps=-r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt commands= - nosetests \ - [] \ No newline at end of file + pytest --cov=openapi_server \ No newline at end of file diff --git a/samples/server/petstore/python-flask/.gitignore b/samples/server/petstore/python-flask/.gitignore index a655050c2631..43995bd42fa2 100644 --- a/samples/server/petstore/python-flask/.gitignore +++ b/samples/server/petstore/python-flask/.gitignore @@ -45,7 +45,9 @@ coverage.xml *,cover .hypothesis/ venv/ +.venv/ .python-version +.pytest_cache # Translations *.mo diff --git a/samples/server/petstore/python-flask/dev-requirements.txt b/samples/server/petstore/python-flask/dev-requirements.txt new file mode 100644 index 000000000000..ccdfca629494 --- /dev/null +++ b/samples/server/petstore/python-flask/dev-requirements.txt @@ -0,0 +1,2 @@ +tox +flake8 diff --git a/samples/server/petstore/python-flask/pom.xml b/samples/server/petstore/python-flask/pom.xml index 2834d92dbc7a..542458a0e48f 100644 --- a/samples/server/petstore/python-flask/pom.xml +++ b/samples/server/petstore/python-flask/pom.xml @@ -27,7 +27,7 @@ 1.2.1 - nose-test + test integration-test exec diff --git a/samples/server/petstore/python-flask/requirements.txt b/samples/server/petstore/python-flask/requirements.txt index 1a01b5804905..029a9dae4cdf 100644 --- a/samples/server/petstore/python-flask/requirements.txt +++ b/samples/server/petstore/python-flask/requirements.txt @@ -1,4 +1,7 @@ -connexion >= 2.0.2 +connexion >= 2.5.0; python_version>="3.6" +connexion >= 2.3.0; python_version=="3.5" +connexion >= 2.3.0; python_version=="3.4" +connexion == 2.4.0; python_version<="2.7" swagger-ui-bundle >= 0.0.2 python_dateutil >= 2.6.0 setuptools >= 21.0.0 diff --git a/samples/server/petstore/python-flask/test-requirements.txt b/samples/server/petstore/python-flask/test-requirements.txt index 7f8d96e6b40e..a2626d875ff4 100644 --- a/samples/server/petstore/python-flask/test-requirements.txt +++ b/samples/server/petstore/python-flask/test-requirements.txt @@ -1,6 +1,4 @@ -flask_testing==0.6.1 -coverage>=4.0.3 -nose>=1.3.7 -pluggy>=0.3.1 -py>=1.4.31 -randomize>=0.13 +pytest~=4.6.7 # needed for python 2.7+3.4 +pytest-cov>=2.8.1 +pytest-randomly==1.2.3 # needed for python 2.7+3.4 +flask_testing==0.6.1 \ No newline at end of file diff --git a/samples/server/petstore/python-flask/test_python3.sh b/samples/server/petstore/python-flask/test_python3.sh index 9bd589401cd3..32fb184fdd83 100755 --- a/samples/server/petstore/python-flask/test_python3.sh +++ b/samples/server/petstore/python-flask/test_python3.sh @@ -1,7 +1,7 @@ #!/bin/bash -REQUIREMENTS_FILE=test-requirements.txt -REQUIREMENTS_OUT=test-requirements.txt.log +REQUIREMENTS_FILE=dev-requirements.txt +REQUIREMENTS_OUT=dev-requirements.txt.log SETUP_OUT=*.egg-info VENV=.venv DEACTIVE=false @@ -18,7 +18,6 @@ fi ### install dependencies pip install -r $REQUIREMENTS_FILE | tee -a $REQUIREMENTS_OUT -python setup.py develop ### run tests tox || exit 1 @@ -27,6 +26,6 @@ tox || exit 1 flake8 --show-source petstore_api/ ### deactivate virtualenv -#if [ $DEACTIVE == true ]; then -# deactivate -#fi +# if [ $DEACTIVE == true ]; then +# deactivate +# fi diff --git a/samples/server/petstore/python-flask/tox.ini b/samples/server/petstore/python-flask/tox.ini index ab4dfbb81b8b..cff71191e6cb 100644 --- a/samples/server/petstore/python-flask/tox.ini +++ b/samples/server/petstore/python-flask/tox.ini @@ -6,5 +6,4 @@ deps=-r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt commands= - nosetests \ - [] \ No newline at end of file + pytest --cov=openapi_server \ No newline at end of file From f2990b34dd7641f1d55f5d2d9a2c570ac575649d Mon Sep 17 00:00:00 2001 From: Justin Black Date: Wed, 18 Dec 2019 17:48:48 -0800 Subject: [PATCH 2/4] Adds ensure-up-to-date changes --- docs/generators/python-aiohttp.md | 1 + docs/generators/python-blueplanet.md | 1 + docs/generators/python-experimental.md | 1 + docs/generators/python-flask.md | 1 + docs/generators/python.md | 1 + samples/client/petstore/python-asyncio/tox.ini | 2 +- samples/client/petstore/python-experimental/tox.ini | 2 +- samples/client/petstore/python-tornado/tox.ini | 2 +- samples/client/petstore/python/tox.ini | 2 +- samples/openapi3/client/petstore/python/tox.ini | 2 +- 10 files changed, 10 insertions(+), 5 deletions(-) diff --git a/docs/generators/python-aiohttp.md b/docs/generators/python-aiohttp.md index 0a9ad07aee85..1879c95755aa 100644 --- a/docs/generators/python-aiohttp.md +++ b/docs/generators/python-aiohttp.md @@ -15,3 +15,4 @@ sidebar_label: python-aiohttp |defaultController|default controller| |default_controller| |supportPython2|support python2| |false| |serverPort|TCP port to listen to in app.run| |8080| +|useNose|use the nose test framework| |false| diff --git a/docs/generators/python-blueplanet.md b/docs/generators/python-blueplanet.md index ae30ec6f0c66..8ad3bc29e446 100644 --- a/docs/generators/python-blueplanet.md +++ b/docs/generators/python-blueplanet.md @@ -15,3 +15,4 @@ sidebar_label: python-blueplanet |defaultController|default controller| |default_controller| |supportPython2|support python2| |false| |serverPort|TCP port to listen to in app.run| |8080| +|useNose|use the nose test framework| |false| diff --git a/docs/generators/python-experimental.md b/docs/generators/python-experimental.md index 65aaee198574..8ba2d699ed5e 100644 --- a/docs/generators/python-experimental.md +++ b/docs/generators/python-experimental.md @@ -12,4 +12,5 @@ sidebar_label: python-experimental |sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true| |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true| |generateSourceCodeOnly|Specifies that only a library source code is to be generated.| |false| +|useNose|use the nose test framework| |false| |library|library template (sub-template) to use: asyncio, tornado, urllib3| |urllib3| diff --git a/docs/generators/python-flask.md b/docs/generators/python-flask.md index f01e68d72136..861f6f87a9e6 100644 --- a/docs/generators/python-flask.md +++ b/docs/generators/python-flask.md @@ -15,3 +15,4 @@ sidebar_label: python-flask |defaultController|default controller| |default_controller| |supportPython2|support python2| |false| |serverPort|TCP port to listen to in app.run| |8080| +|useNose|use the nose test framework| |false| diff --git a/docs/generators/python.md b/docs/generators/python.md index 023e92b66716..ee581848b024 100644 --- a/docs/generators/python.md +++ b/docs/generators/python.md @@ -12,4 +12,5 @@ sidebar_label: python |sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true| |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true| |generateSourceCodeOnly|Specifies that only a library source code is to be generated.| |false| +|useNose|use the nose test framework| |false| |library|library template (sub-template) to use: asyncio, tornado, urllib3| |urllib3| diff --git a/samples/client/petstore/python-asyncio/tox.ini b/samples/client/petstore/python-asyncio/tox.ini index b11bda70e648..8989fc3c4d96 100644 --- a/samples/client/petstore/python-asyncio/tox.ini +++ b/samples/client/petstore/python-asyncio/tox.ini @@ -6,4 +6,4 @@ deps=-r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt commands= - pytest --cov=petstore_api \ No newline at end of file + pytest --cov=petstore_api diff --git a/samples/client/petstore/python-experimental/tox.ini b/samples/client/petstore/python-experimental/tox.ini index 2e5fc503d039..169d895329bf 100644 --- a/samples/client/petstore/python-experimental/tox.ini +++ b/samples/client/petstore/python-experimental/tox.ini @@ -6,4 +6,4 @@ deps=-r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt commands= - pytest --cov=petstore_api \ No newline at end of file + pytest --cov=petstore_api diff --git a/samples/client/petstore/python-tornado/tox.ini b/samples/client/petstore/python-tornado/tox.ini index 2e5fc503d039..169d895329bf 100644 --- a/samples/client/petstore/python-tornado/tox.ini +++ b/samples/client/petstore/python-tornado/tox.ini @@ -6,4 +6,4 @@ deps=-r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt commands= - pytest --cov=petstore_api \ No newline at end of file + pytest --cov=petstore_api diff --git a/samples/client/petstore/python/tox.ini b/samples/client/petstore/python/tox.ini index 2e5fc503d039..169d895329bf 100644 --- a/samples/client/petstore/python/tox.ini +++ b/samples/client/petstore/python/tox.ini @@ -6,4 +6,4 @@ deps=-r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt commands= - pytest --cov=petstore_api \ No newline at end of file + pytest --cov=petstore_api diff --git a/samples/openapi3/client/petstore/python/tox.ini b/samples/openapi3/client/petstore/python/tox.ini index 2e5fc503d039..169d895329bf 100644 --- a/samples/openapi3/client/petstore/python/tox.ini +++ b/samples/openapi3/client/petstore/python/tox.ini @@ -6,4 +6,4 @@ deps=-r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt commands= - pytest --cov=petstore_api \ No newline at end of file + pytest --cov=petstore_api From 18d8d2f12a1cccbb6d6b345b0e44d02e2bf3f1fe Mon Sep 17 00:00:00 2001 From: Justin Black Date: Thu, 19 Dec 2019 09:58:27 -0800 Subject: [PATCH 3/4] Adds setup.cfg to python clients so we can configure nose when useNose=true --- .../codegen/languages/PythonClientCodegen.java | 1 + .../src/main/resources/python/setup_cfg.mustache | 13 +++++++++++++ samples/client/petstore/python-asyncio/setup.cfg | 2 ++ samples/client/petstore/python-tornado/setup.cfg | 2 ++ 4 files changed, 18 insertions(+) create mode 100644 modules/openapi-generator/src/main/resources/python/setup_cfg.mustache create mode 100644 samples/client/petstore/python-asyncio/setup.cfg create mode 100644 samples/client/petstore/python-tornado/setup.cfg diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientCodegen.java index 1ff48c88da60..ef410594ec91 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientCodegen.java @@ -237,6 +237,7 @@ public void processOpts() { supportingFiles.add(new SupportingFile("tox.mustache", "", "tox.ini")); supportingFiles.add(new SupportingFile("test-requirements.mustache", "", "test-requirements.txt")); supportingFiles.add(new SupportingFile("requirements.mustache", "", "requirements.txt")); + supportingFiles.add(new SupportingFile("setup_cfg.mustache", "", "setup.cfg")); supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh")); supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore")); diff --git a/modules/openapi-generator/src/main/resources/python/setup_cfg.mustache b/modules/openapi-generator/src/main/resources/python/setup_cfg.mustache new file mode 100644 index 000000000000..d89aa72ee4c1 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/python/setup_cfg.mustache @@ -0,0 +1,13 @@ +{{#useNose}} +[nosetests] +logging-clear-handlers=true +verbosity=2 +randomize=true +exe=true +with-coverage=true +cover-package=petstore_api +cover-erase=true + +{{/useNose}} +[flake8] +max-line-length=99 diff --git a/samples/client/petstore/python-asyncio/setup.cfg b/samples/client/petstore/python-asyncio/setup.cfg new file mode 100644 index 000000000000..11433ee875ab --- /dev/null +++ b/samples/client/petstore/python-asyncio/setup.cfg @@ -0,0 +1,2 @@ +[flake8] +max-line-length=99 diff --git a/samples/client/petstore/python-tornado/setup.cfg b/samples/client/petstore/python-tornado/setup.cfg new file mode 100644 index 000000000000..11433ee875ab --- /dev/null +++ b/samples/client/petstore/python-tornado/setup.cfg @@ -0,0 +1,2 @@ +[flake8] +max-line-length=99 From f856953c77f6ae96e9eb529dbd6917696f933623 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Thu, 19 Dec 2019 12:11:20 -0800 Subject: [PATCH 4/4] Adds fix for python-aiohttp testing, adds files missing from ensure-up-to-date --- .../PythonAiohttpConnexionServerCodegen.java | 1 + .../python-aiohttp/gitignore.mustache | 66 +++++++++++++++++++ .../resources/python-aiohttp/tox.mustache | 1 + .../openapi3/client/petstore/python/setup.cfg | 2 + .../server/petstore/python-aiohttp/.gitignore | 66 +++++++++++++++++++ .../server/petstore/python-aiohttp/tox.ini | 1 + 6 files changed, 137 insertions(+) create mode 100644 modules/openapi-generator/src/main/resources/python-aiohttp/gitignore.mustache create mode 100644 samples/openapi3/client/petstore/python/setup.cfg create mode 100644 samples/server/petstore/python-aiohttp/.gitignore diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonAiohttpConnexionServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonAiohttpConnexionServerCodegen.java index 5fc23457e3da..eac3c6b0b2e1 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonAiohttpConnexionServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonAiohttpConnexionServerCodegen.java @@ -45,5 +45,6 @@ protected void addSupportingFiles() { supportingFiles.add(new SupportingFile("__init__test.mustache", testPackage, "__init__.py")); supportingFiles.add(new SupportingFile("__init__main.mustache", packagePath(), "__init__.py")); supportingFiles.add(new SupportingFile("tox.mustache", "", "tox.ini")); + supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore")); } } diff --git a/modules/openapi-generator/src/main/resources/python-aiohttp/gitignore.mustache b/modules/openapi-generator/src/main/resources/python-aiohttp/gitignore.mustache new file mode 100644 index 000000000000..43995bd42fa2 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/python-aiohttp/gitignore.mustache @@ -0,0 +1,66 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +env/ +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +*.egg-info/ +.installed.cfg +*.egg + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*,cover +.hypothesis/ +venv/ +.venv/ +.python-version +.pytest_cache + +# Translations +*.mo +*.pot + +# Django stuff: +*.log + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +#Ipython Notebook +.ipynb_checkpoints diff --git a/modules/openapi-generator/src/main/resources/python-aiohttp/tox.mustache b/modules/openapi-generator/src/main/resources/python-aiohttp/tox.mustache index 58e9f8ff6f5e..87cc65eeeb78 100644 --- a/modules/openapi-generator/src/main/resources/python-aiohttp/tox.mustache +++ b/modules/openapi-generator/src/main/resources/python-aiohttp/tox.mustache @@ -1,5 +1,6 @@ [tox] envlist = py3 +skipsdist=True [testenv] deps=-r{toxinidir}/requirements.txt diff --git a/samples/openapi3/client/petstore/python/setup.cfg b/samples/openapi3/client/petstore/python/setup.cfg new file mode 100644 index 000000000000..11433ee875ab --- /dev/null +++ b/samples/openapi3/client/petstore/python/setup.cfg @@ -0,0 +1,2 @@ +[flake8] +max-line-length=99 diff --git a/samples/server/petstore/python-aiohttp/.gitignore b/samples/server/petstore/python-aiohttp/.gitignore new file mode 100644 index 000000000000..43995bd42fa2 --- /dev/null +++ b/samples/server/petstore/python-aiohttp/.gitignore @@ -0,0 +1,66 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +env/ +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +*.egg-info/ +.installed.cfg +*.egg + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*,cover +.hypothesis/ +venv/ +.venv/ +.python-version +.pytest_cache + +# Translations +*.mo +*.pot + +# Django stuff: +*.log + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +#Ipython Notebook +.ipynb_checkpoints diff --git a/samples/server/petstore/python-aiohttp/tox.ini b/samples/server/petstore/python-aiohttp/tox.ini index cff71191e6cb..0f7cd42b8a8b 100644 --- a/samples/server/petstore/python-aiohttp/tox.ini +++ b/samples/server/petstore/python-aiohttp/tox.ini @@ -1,5 +1,6 @@ [tox] envlist = py3 +skipsdist=True [testenv] deps=-r{toxinidir}/requirements.txt