diff --git a/bin/python-server-all.sh b/bin/python-server-all.sh index 5a4f5c75489..5fe3176eed9 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/docs/generators/python-aiohttp.md b/docs/generators/python-aiohttp.md index 16a4fc8056f..a116fc6e96b 100644 --- a/docs/generators/python-aiohttp.md +++ b/docs/generators/python-aiohttp.md @@ -16,3 +16,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 21891902860..7114953628d 100644 --- a/docs/generators/python-blueplanet.md +++ b/docs/generators/python-blueplanet.md @@ -16,3 +16,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 65aaee19857..8ba2d699ed5 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 05f6e46a1c6..1b68530a868 100644 --- a/docs/generators/python-flask.md +++ b/docs/generators/python-flask.md @@ -16,3 +16,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 023e92b6671..ee581848b02 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/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 5d6c5ca102e..5b6e133cac2 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 class PythonAbstractConnexionServerCodegen extends DefaultCodegen impleme 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 class PythonAbstractConnexionServerCodegen extends DefaultCodegen impleme 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 class PythonAbstractConnexionServerCodegen extends DefaultCodegen impleme 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 0f725396b66..eac3c6b0b2e 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,7 @@ public class PythonAiohttpConnexionServerCodegen extends PythonAbstractConnexion 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")); + supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore")); } } 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 4538ee1b5f2..ef410594ec9 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 class PythonClientCodegen extends DefaultCodegen implements CodegenConfig "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 class PythonClientCodegen extends DefaultCodegen implements CodegenConfig .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 class PythonClientCodegen extends DefaultCodegen implements CodegenConfig 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 class PythonClientCodegen extends DefaultCodegen implements CodegenConfig 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) { @@ -228,6 +237,7 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig 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")); @@ -579,6 +589,10 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig 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/gitignore.mustache b/modules/openapi-generator/src/main/resources/python-aiohttp/gitignore.mustache new file mode 100644 index 00000000000..43995bd42fa --- /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/test-requirements.mustache b/modules/openapi-generator/src/main/resources/python-aiohttp/test-requirements.mustache index 1cb425f6551..16ba4a48111 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 00000000000..87cc65eeeb7 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/python-aiohttp/tox.mustache @@ -0,0 +1,10 @@ +[tox] +envlist = py3 +skipsdist=True + +[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 a655050c263..a77a0ebd166 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 7f8d96e6b40..efad5423cb5 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 3efa994317d..7b3246c36e2 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 a655050c263..43995bd42fa 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 b5a702d5de8..921d67d029a 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 7f8d96e6b40..efad5423cb5 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 1195b3391b0..7fcd185a8d8 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 a655050c263..43995bd42fa 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 023ff960788..338b229bae5 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/setup_cfg.mustache b/modules/openapi-generator/src/main/resources/python/setup_cfg.mustache new file mode 100644 index 00000000000..d89aa72ee4c --- /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/modules/openapi-generator/src/main/resources/python/test-requirements.mustache b/modules/openapi-generator/src/main/resources/python/test-requirements.mustache index d9e3f20b536..12021b47a1c 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 585feb3c681..fe989faf930 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 f74b17266ce..d3afcc8f844 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 class PythonClientOptionsProvider implements OptionsProvider { .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 47d59ba78c4..ce9d564f470 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 @@ public class PythonClientOptionsTest extends AbstractOptionsTest { 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 a655050c263..43995bd42fa 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 49182426e20..ccdfca62949 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/setup.cfg b/samples/client/petstore/python-asyncio/setup.cfg new file mode 100644 index 00000000000..11433ee875a --- /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-asyncio/test-requirements.txt b/samples/client/petstore/python-asyncio/test-requirements.txt index 600ac897bb7..4ed3991cbec 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 9160e25714a..1a8e712f73c 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 65f5351ddcc..8989fc3c4d9 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 diff --git a/samples/client/petstore/python-experimental/.gitignore b/samples/client/petstore/python-experimental/.gitignore index a655050c263..43995bd42fa 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 f50c13b5c50..ccdfca62949 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 3c946333186..742451c23b2 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 26b7a359d58..11433ee875a 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 5816b874953..06f7754d204 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 35de07deec7..b2f344ec897 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 8511d46cd79..3205dfd07da 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 3d0be613cfc..169d895329b 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 diff --git a/samples/client/petstore/python-tornado/.gitignore b/samples/client/petstore/python-tornado/.gitignore index a655050c263..43995bd42fa 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 f50c13b5c50..ccdfca62949 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 821e12dfe8d..9aae57304fc 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/setup.cfg b/samples/client/petstore/python-tornado/setup.cfg new file mode 100644 index 00000000000..11433ee875a --- /dev/null +++ b/samples/client/petstore/python-tornado/setup.cfg @@ -0,0 +1,2 @@ +[flake8] +max-line-length=99 diff --git a/samples/client/petstore/python-tornado/test-requirements.txt b/samples/client/petstore/python-tornado/test-requirements.txt index 2702246c0e6..4ed3991cbec 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 7b5795ec24a..3118c449124 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 3d0be613cfc..169d895329b 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 diff --git a/samples/client/petstore/python/.gitignore b/samples/client/petstore/python/.gitignore index a655050c263..43995bd42fa 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 f50c13b5c50..ccdfca62949 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 db2d09246c3..71814d4388d 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 26b7a359d58..11433ee875a 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 2702246c0e6..4ed3991cbec 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 fb0eaed6ffa..4c9488a3329 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 7b5795ec24a..3118c449124 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 80d34f6b5f2..b7650f042eb 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 @@ class PetApiTests(unittest.TestCase): 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 @@ class PetApiTests(unittest.TestCase): 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 3d0be613cfc..169d895329b 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 diff --git a/samples/openapi3/client/petstore/python/.gitignore b/samples/openapi3/client/petstore/python/.gitignore index a655050c263..43995bd42fa 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 00000000000..ccdfca62949 --- /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 2fa7d0a113f..98955483eb8 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/setup.cfg b/samples/openapi3/client/petstore/python/setup.cfg new file mode 100644 index 00000000000..11433ee875a --- /dev/null +++ b/samples/openapi3/client/petstore/python/setup.cfg @@ -0,0 +1,2 @@ +[flake8] +max-line-length=99 diff --git a/samples/openapi3/client/petstore/python/test-requirements.txt b/samples/openapi3/client/petstore/python/test-requirements.txt index 2702246c0e6..4ed3991cbec 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 fb0eaed6ffa..24c3cbdd496 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 daf08d5bacb..ab02e6e4080 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 3d0be613cfc..169d895329b 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 diff --git a/samples/openapi3/server/petstore/python-flask-python2/.gitignore b/samples/openapi3/server/petstore/python-flask-python2/.gitignore index a655050c263..43995bd42fa 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 bc535706622..5c5ce2a1a26 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 7f8d96e6b40..a2626d875ff 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 26985414c88..d05c607610c 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 a655050c263..43995bd42fa 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 1a01b580490..029a9dae4cd 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 7f8d96e6b40..a2626d875ff 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 ab4dfbb81b8..cff71191e6c 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/.gitignore b/samples/server/petstore/python-aiohttp/.gitignore new file mode 100644 index 00000000000..43995bd42fa --- /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/dev-requirements.txt b/samples/server/petstore/python-aiohttp/dev-requirements.txt new file mode 100644 index 00000000000..ccdfca62949 --- /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 8e77233a458..26c4b7c492d 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 1cb425f6551..31b28baaf28 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 c6a92d00aed..65d96267d4f 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 00000000000..0f7cd42b8a8 --- /dev/null +++ b/samples/server/petstore/python-aiohttp/tox.ini @@ -0,0 +1,10 @@ +[tox] +envlist = py3 +skipsdist=True + +[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 0c89fc927e3..58592f031f6 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 a655050c263..a77a0ebd166 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 7f8d96e6b40..a2626d875ff 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 3e0b644eec4..d2eb61d57c7 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 a655050c263..43995bd42fa 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 00000000000..ccdfca62949 --- /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 113c387d5f2..430bddf2ed3 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 bc535706622..5c5ce2a1a26 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 7f8d96e6b40..a2626d875ff 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 e579f4d7f55..89e56c485de 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 26985414c88..d05c607610c 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 a655050c263..43995bd42fa 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 00000000000..ccdfca62949 --- /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 2834d92dbc7..542458a0e48 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 1a01b580490..029a9dae4cd 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 7f8d96e6b40..a2626d875ff 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 9bd589401cd..32fb184fdd8 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 ab4dfbb81b8..cff71191e6c 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