[Python] Updates python test framework to pytest (#4765)

* Switches python generators to use pytest, useNose CLI option added if to allow nose to be used instead

* Adds ensure-up-to-date changes

* Adds setup.cfg to python clients so we can configure nose when useNose=true

* Adds fix for python-aiohttp testing, adds files missing from ensure-up-to-date
This commit is contained in:
Justin Black 2019-12-22 00:14:04 -06:00 committed by William Cheng
parent 1084cd38a1
commit 3959530465
96 changed files with 385 additions and 188 deletions

View File

@ -3,3 +3,4 @@
./bin/python-server-aiohttp-petstore.sh ./bin/python-server-aiohttp-petstore.sh
./bin/python-server-flask-petstore.sh ./bin/python-server-flask-petstore.sh
./bin/python-server-flask-petstore-python2.sh ./bin/python-server-flask-petstore-python2.sh
./bin/python-server-blueplanet-petstore.sh

View File

@ -16,3 +16,4 @@ sidebar_label: python-aiohttp
|defaultController|default controller| |default_controller| |defaultController|default controller| |default_controller|
|supportPython2|support python2| |false| |supportPython2|support python2| |false|
|serverPort|TCP port to listen to in app.run| |8080| |serverPort|TCP port to listen to in app.run| |8080|
|useNose|use the nose test framework| |false|

View File

@ -16,3 +16,4 @@ sidebar_label: python-blueplanet
|defaultController|default controller| |default_controller| |defaultController|default controller| |default_controller|
|supportPython2|support python2| |false| |supportPython2|support python2| |false|
|serverPort|TCP port to listen to in app.run| |8080| |serverPort|TCP port to listen to in app.run| |8080|
|useNose|use the nose test framework| |false|

View File

@ -12,4 +12,5 @@ sidebar_label: python-experimental
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true| |sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true| |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
|generateSourceCodeOnly|Specifies that only a library source code is to be generated.| |false| |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| |library|library template (sub-template) to use: asyncio, tornado, urllib3| |urllib3|

View File

@ -16,3 +16,4 @@ sidebar_label: python-flask
|defaultController|default controller| |default_controller| |defaultController|default controller| |default_controller|
|supportPython2|support python2| |false| |supportPython2|support python2| |false|
|serverPort|TCP port to listen to in app.run| |8080| |serverPort|TCP port to listen to in app.run| |8080|
|useNose|use the nose test framework| |false|

View File

@ -12,4 +12,5 @@ sidebar_label: python
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true| |sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true| |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
|generateSourceCodeOnly|Specifies that only a library source code is to be generated.| |false| |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| |library|library template (sub-template) to use: asyncio, tornado, urllib3| |urllib3|

View File

@ -48,6 +48,8 @@ public class PythonAbstractConnexionServerCodegen extends DefaultCodegen impleme
public static final String CONTROLLER_PACKAGE = "controllerPackage"; public static final String CONTROLLER_PACKAGE = "controllerPackage";
public static final String DEFAULT_CONTROLLER = "defaultController"; public static final String DEFAULT_CONTROLLER = "defaultController";
public static final String SUPPORT_PYTHON2 = "supportPython2"; 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"; static final String MEDIA_TYPE = "mediaType";
protected int serverPort = 8080; protected int serverPort = 8080;
@ -57,6 +59,7 @@ public class PythonAbstractConnexionServerCodegen extends DefaultCodegen impleme
protected String defaultController; protected String defaultController;
protected Map<Character, String> regexModifiers; protected Map<Character, String> regexModifiers;
protected boolean fixBodyName; protected boolean fixBodyName;
protected boolean useNose = Boolean.FALSE;
public PythonAbstractConnexionServerCodegen(String templateDirectory, boolean fixBodyNameValue) { public PythonAbstractConnexionServerCodegen(String templateDirectory, boolean fixBodyNameValue) {
super(); super();
@ -156,6 +159,8 @@ public class PythonAbstractConnexionServerCodegen extends DefaultCodegen impleme
defaultValue("false")); defaultValue("false"));
cliOptions.add(new CliOption("serverPort", "TCP port to listen to in app.run"). cliOptions.add(new CliOption("serverPort", "TCP port to listen to in app.run").
defaultValue("8080")); defaultValue("8080"));
cliOptions.add(CliOption.newBoolean(USE_NOSE, "use the nose test framework").
defaultValue(Boolean.FALSE.toString()));
} }
protected void addSupportingFiles() { protected void addSupportingFiles() {
@ -200,6 +205,9 @@ public class PythonAbstractConnexionServerCodegen extends DefaultCodegen impleme
additionalProperties.put(SUPPORT_PYTHON2, Boolean.TRUE); additionalProperties.put(SUPPORT_PYTHON2, Boolean.TRUE);
typeMapping.put("long", "long"); 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("__main__.mustache", packagePath(), "__main__.py"));
supportingFiles.add(new SupportingFile("util.mustache", packagePath(), "util.py")); supportingFiles.add(new SupportingFile("util.mustache", packagePath(), "util.py"));
supportingFiles.add(new SupportingFile("typing_utils.mustache", packagePath(), "typing_utils.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; controllerPackage = packageName + "." + controllerPackage;
} }
public void setUseNose(String val) {
this.useNose = Boolean.valueOf(val);
}
private static String packageToPath(String pkg) { private static String packageToPath(String pkg) {
return pkg.replace(".", File.separator); return pkg.replace(".", File.separator);
} }

View File

@ -44,5 +44,7 @@ public class PythonAiohttpConnexionServerCodegen extends PythonAbstractConnexion
supportingFiles.add(new SupportingFile("conftest.mustache", testPackage, "conftest.py")); supportingFiles.add(new SupportingFile("conftest.mustache", testPackage, "conftest.py"));
supportingFiles.add(new SupportingFile("__init__test.mustache", testPackage, "__init__.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("__init__main.mustache", packagePath(), "__init__.py"));
supportingFiles.add(new SupportingFile("tox.mustache", "", "tox.ini"));
supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore"));
} }
} }

View File

@ -40,6 +40,8 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig
public static final String PACKAGE_URL = "packageUrl"; public static final String PACKAGE_URL = "packageUrl";
public static final String DEFAULT_LIBRARY = "urllib3"; 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 packageName = "openapi_client";
protected String packageVersion = "1.0.0"; protected String packageVersion = "1.0.0";
@ -47,6 +49,7 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig
protected String packageUrl; protected String packageUrl;
protected String apiDocPath = "docs/"; protected String apiDocPath = "docs/";
protected String modelDocPath = "docs/"; protected String modelDocPath = "docs/";
protected boolean useNose = Boolean.FALSE;
protected Map<Character, String> regexModifiers; protected Map<Character, String> regexModifiers;
@ -127,7 +130,7 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig
"and", "del", "from", "not", "while", "as", "elif", "global", "or", "with", "and", "del", "from", "not", "while", "as", "elif", "global", "or", "with",
"assert", "else", "if", "pass", "yield", "break", "except", "import", "assert", "else", "if", "pass", "yield", "break", "except", "import",
"print", "class", "exec", "in", "raise", "continue", "finally", "is", "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")); "False", "async", "await"));
regexModifiers = new HashMap<Character, String>(); regexModifiers = new HashMap<Character, String>();
@ -151,6 +154,8 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig
.defaultValue(Boolean.TRUE.toString())); .defaultValue(Boolean.TRUE.toString()));
cliOptions.add(new CliOption(CodegenConstants.SOURCECODEONLY_GENERATION, CodegenConstants.SOURCECODEONLY_GENERATION_DESC) cliOptions.add(new CliOption(CodegenConstants.SOURCECODEONLY_GENERATION, CodegenConstants.SOURCECODEONLY_GENERATION_DESC)
.defaultValue(Boolean.FALSE.toString())); .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("urllib3", "urllib3-based client");
supportedLibraries.put("asyncio", "Asyncio-based client (python 3.5+)"); 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)) { if (additionalProperties.containsKey(CodegenConstants.PACKAGE_VERSION)) {
setPackageVersion((String) additionalProperties.get(CodegenConstants.PACKAGE_VERSION)); setPackageVersion((String) additionalProperties.get(CodegenConstants.PACKAGE_VERSION));
} }
Boolean generateSourceCodeOnly = false; Boolean generateSourceCodeOnly = false;
if (additionalProperties.containsKey(CodegenConstants.SOURCECODEONLY_GENERATION)) { if (additionalProperties.containsKey(CodegenConstants.SOURCECODEONLY_GENERATION)) {
@ -216,6 +221,10 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig
setPackageUrl((String) additionalProperties.get(PACKAGE_URL)); setPackageUrl((String) additionalProperties.get(PACKAGE_URL));
} }
if (additionalProperties.containsKey(USE_NOSE)) {
setUseNose((String) additionalProperties.get(USE_NOSE));
}
String readmePath = "README.md"; String readmePath = "README.md";
String readmeTemplate = "README.mustache"; String readmeTemplate = "README.mustache";
if (generateSourceCodeOnly) { 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("tox.mustache", "", "tox.ini"));
supportingFiles.add(new SupportingFile("test-requirements.mustache", "", "test-requirements.txt")); supportingFiles.add(new SupportingFile("test-requirements.mustache", "", "test-requirements.txt"));
supportingFiles.add(new SupportingFile("requirements.mustache", "", "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("git_push.sh.mustache", "", "git_push.sh"));
supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore")); supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore"));
@ -579,6 +589,10 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig
this.packageName = packageName; this.packageName = packageName;
} }
public void setUseNose(String val) {
this.useNose = Boolean.valueOf(val);
}
public void setProjectName(String projectName) { public void setProjectName(String projectName) {
this.projectName = projectName; this.projectName = projectName;
} }

View File

@ -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

View File

@ -1,6 +1,13 @@
{{#useNose}}
coverage>=4.0.3 coverage>=4.0.3
pytest>=1.3.7 nose>=1.3.7
pluggy>=0.3.1 pluggy>=0.3.1
py>=1.4.31 py>=1.4.31
randomize>=0.13 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 pytest-aiohttp>=0.3.0
{{/useNose}}

View File

@ -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}}

View File

@ -46,6 +46,7 @@ coverage.xml
.hypothesis/ .hypothesis/
venv/ venv/
.python-version .python-version
.pytest_cache
# Translations # Translations
*.mo *.mo

View File

@ -1,6 +1,13 @@
flask_testing==0.6.1 {{#useNose}}
coverage>=4.0.3 coverage>=4.0.3
nose>=1.3.7 nose>=1.3.7
pluggy>=0.3.1 pluggy>=0.3.1
py>=1.4.31 py>=1.4.31
randomize>=0.13 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

View File

@ -6,5 +6,4 @@ deps=-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt -r{toxinidir}/test-requirements.txt
commands= commands=
nosetests \ {{^useNose}}pytest --cov={{{packageName}}}{{/useNose}}{{#useNose}}nosetests{{/useNose}}
[]

View File

@ -45,7 +45,9 @@ coverage.xml
*,cover *,cover
.hypothesis/ .hypothesis/
venv/ venv/
.venv/
.python-version .python-version
.pytest_cache
# Translations # Translations
*.mo *.mo

View File

@ -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 swagger-ui-bundle >= 0.0.2
python_dateutil >= 2.6.0 python_dateutil >= 2.6.0
{{#supportPython2}} {{#supportPython2}}

View File

@ -1,6 +1,13 @@
flask_testing==0.6.1 {{#useNose}}
coverage>=4.0.3 coverage>=4.0.3
nose>=1.3.7 nose>=1.3.7
pluggy>=0.3.1 pluggy>=0.3.1
py>=1.4.31 py>=1.4.31
randomize>=0.13 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

View File

@ -6,5 +6,4 @@ deps=-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt -r{toxinidir}/test-requirements.txt
commands= commands=
nosetests \ {{^useNose}}pytest --cov={{{packageName}}}{{/useNose}}{{#useNose}}nosetests{{/useNose}}
[]

View File

@ -45,7 +45,9 @@ coverage.xml
*,cover *,cover
.hypothesis/ .hypothesis/
venv/ venv/
.venv/
.python-version .python-version
.pytest_cache
# Translations # Translations
*.mo *.mo

View File

@ -1,13 +1,13 @@
{{^asyncio}} {{#useNose}}
coverage>=4.0.3 coverage>=4.0.3
nose>=1.3.7 nose>=1.3.7
{{/asyncio}}
{{#asyncio}}
pytest>=3.6.0
pytest-cov>=2.6.1
{{/asyncio}}
pluggy>=0.3.1 pluggy>=0.3.1
py>=1.4.31 py>=1.4.31
randomize>=0.13 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"

View File

@ -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

View File

@ -1,11 +1,12 @@
{{^asyncio}} {{#useNose}}
coverage>=4.0.3 coverage>=4.0.3
nose>=1.3.7 nose>=1.3.7
{{/asyncio}}
{{#asyncio}}
pytest>=3.6.0
pytest-cov>=2.6.1
{{/asyncio}}
pluggy>=0.3.1 pluggy>=0.3.1
py>=1.4.31 py>=1.4.31
randomize>=0.13 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}}

View File

@ -11,10 +11,4 @@ deps=-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt -r{toxinidir}/test-requirements.txt
commands= commands=
{{^asyncio}} {{^useNose}}pytest --cov={{{packageName}}}{{/useNose}}{{#useNose}}nosetests{{/useNose}}
nosetests \
[]
{{/asyncio}}
{{#asyncio}}
pytest -v --cov {{{packageName}}}
{{/asyncio}}

View File

@ -28,6 +28,7 @@ public class PythonClientOptionsProvider implements OptionsProvider {
public static final String PROJECT_NAME_VALUE = "swagger-client-python"; 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_VERSION_VALUE = "1.0.0-SNAPSHOT";
public static final String PACKAGE_URL_VALUE = ""; public static final String PACKAGE_URL_VALUE = "";
public static final String USE_NOSE_VALUE = "false";
@Override @Override
public String getLanguage() { public String getLanguage() {
@ -45,6 +46,7 @@ public class PythonClientOptionsProvider implements OptionsProvider {
.put(CodegenConstants.HIDE_GENERATION_TIMESTAMP, "true") .put(CodegenConstants.HIDE_GENERATION_TIMESTAMP, "true")
.put(CodegenConstants.SOURCECODEONLY_GENERATION, "false") .put(CodegenConstants.SOURCECODEONLY_GENERATION, "false")
.put(CodegenConstants.LIBRARY, "urllib3") .put(CodegenConstants.LIBRARY, "urllib3")
.put(PythonClientCodegen.USE_NOSE, USE_NOSE_VALUE)
.build(); .build();
} }

View File

@ -56,6 +56,9 @@ public class PythonClientOptionsTest extends AbstractOptionsTest {
clientCodegen.setPackageUrl(PythonClientOptionsProvider.PACKAGE_URL_VALUE); clientCodegen.setPackageUrl(PythonClientOptionsProvider.PACKAGE_URL_VALUE);
times = 1; times = 1;
clientCodegen.setUseNose(PythonClientOptionsProvider.USE_NOSE_VALUE);
times = 1;
clientCodegen.packagePath(); clientCodegen.packagePath();
result = PythonClientOptionsProvider.PACKAGE_NAME_VALUE.replace('.', File.separatorChar); result = PythonClientOptionsProvider.PACKAGE_NAME_VALUE.replace('.', File.separatorChar);
minTimes = 1; minTimes = 1;

View File

@ -45,7 +45,9 @@ coverage.xml
*,cover *,cover
.hypothesis/ .hypothesis/
venv/ venv/
.venv/
.python-version .python-version
.pytest_cache
# Translations # Translations
*.mo *.mo

View File

@ -1,4 +1,2 @@
tox tox
coverage
randomize
flake8 flake8

View File

@ -0,0 +1,2 @@
[flake8]
max-line-length=99

View File

@ -1,5 +1,3 @@
pytest>=3.6.0 pytest~=4.6.7 # needed for python 2.7+3.4
pytest-cov>=2.6.1 pytest-cov>=2.8.1
pluggy>=0.3.1 pytest-randomly==1.2.3 # needed for python 2.7+3.4
py>=1.4.31
randomize>=0.13

View File

@ -18,7 +18,6 @@ fi
### install dependencies ### install dependencies
pip install -r $REQUIREMENTS_FILE | tee -a $REQUIREMENTS_OUT pip install -r $REQUIREMENTS_FILE | tee -a $REQUIREMENTS_OUT
python setup.py develop
### run tests ### run tests
tox || exit 1 tox || exit 1

View File

@ -6,4 +6,4 @@ deps=-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt -r{toxinidir}/test-requirements.txt
commands= commands=
pytest -v --cov petstore_api pytest --cov=petstore_api

View File

@ -45,7 +45,9 @@ coverage.xml
*,cover *,cover
.hypothesis/ .hypothesis/
venv/ venv/
.venv/
.python-version .python-version
.pytest_cache
# Translations # Translations
*.mo *.mo

View File

@ -1,5 +1,2 @@
nose
tox tox
coverage
randomize
flake8 flake8

View File

@ -27,7 +27,7 @@
<version>1.2.1</version> <version>1.2.1</version>
<executions> <executions>
<execution> <execution>
<id>nose-test</id> <id>test</id>
<phase>integration-test</phase> <phase>integration-test</phase>
<goals> <goals>
<goal>exec</goal> <goal>exec</goal>

View File

@ -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] [flake8]
max-line-length=99 max-line-length=99

View File

@ -1,7 +1,4 @@
coverage>=4.0.3 pytest~=4.6.7 # needed for python 2.7+3.4
nose>=1.3.7 pytest-cov>=2.8.1
pluggy>=0.3.1 pytest-randomly==1.2.3 # needed for python 2.7+3.4
py>=1.4.31 mock; python_version<="2.7"
randomize>=0.13
mock; python_version<="2.7"

View File

@ -19,11 +19,9 @@ fi
### install dependencies ### install dependencies
pip install -r $REQUIREMENTS_FILE | tee -a $REQUIREMENTS_OUT pip install -r $REQUIREMENTS_FILE | tee -a $REQUIREMENTS_OUT
pip install -r test-requirements.txt
python setup.py develop
### run tests ### run tests
nosetests || exit 1 tox -e py27 || exit 1
### static analysis of code ### static analysis of code
flake8 --show-source petstore_api/ flake8 --show-source petstore_api/

View File

@ -18,7 +18,6 @@ fi
### install dependencies ### install dependencies
pip install -r $REQUIREMENTS_FILE | tee -a $REQUIREMENTS_OUT pip install -r $REQUIREMENTS_FILE | tee -a $REQUIREMENTS_OUT
python setup.py develop
### run tests ### run tests
tox || exit 1 tox || exit 1

View File

@ -6,5 +6,4 @@ deps=-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt -r{toxinidir}/test-requirements.txt
commands= commands=
nosetests \ pytest --cov=petstore_api
[]

View File

@ -45,7 +45,9 @@ coverage.xml
*,cover *,cover
.hypothesis/ .hypothesis/
venv/ venv/
.venv/
.python-version .python-version
.pytest_cache
# Translations # Translations
*.mo *.mo

View File

@ -1,5 +1,2 @@
nose
tox tox
coverage
randomize
flake8 flake8

View File

@ -27,7 +27,7 @@
<version>1.2.1</version> <version>1.2.1</version>
<executions> <executions>
<execution> <execution>
<id>nose-test</id> <id>test</id>
<phase>integration-test</phase> <phase>integration-test</phase>
<goals> <goals>
<goal>exec</goal> <goal>exec</goal>

View File

@ -0,0 +1,2 @@
[flake8]
max-line-length=99

View File

@ -1,5 +1,3 @@
coverage>=4.0.3 pytest~=4.6.7 # needed for python 2.7+3.4
nose>=1.3.7 pytest-cov>=2.8.1
pluggy>=0.3.1 pytest-randomly==1.2.3 # needed for python 2.7+3.4
py>=1.4.31
randomize>=0.13

View File

@ -18,7 +18,6 @@ fi
### install dependencies ### install dependencies
pip install -r $REQUIREMENTS_FILE | tee -a $REQUIREMENTS_OUT pip install -r $REQUIREMENTS_FILE | tee -a $REQUIREMENTS_OUT
python setup.py develop
### run tests ### run tests
tox || exit 1 tox || exit 1

View File

@ -6,5 +6,4 @@ deps=-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt -r{toxinidir}/test-requirements.txt
commands= commands=
nosetests \ pytest --cov=petstore_api
[]

View File

@ -45,7 +45,9 @@ coverage.xml
*,cover *,cover
.hypothesis/ .hypothesis/
venv/ venv/
.venv/
.python-version .python-version
.pytest_cache
# Translations # Translations
*.mo *.mo

View File

@ -1,5 +1,2 @@
nose
tox tox
coverage
randomize
flake8 flake8

View File

@ -27,7 +27,7 @@
<version>1.2.1</version> <version>1.2.1</version>
<executions> <executions>
<execution> <execution>
<id>nose-test</id> <id>test</id>
<phase>integration-test</phase> <phase>integration-test</phase>
<goals> <goals>
<goal>exec</goal> <goal>exec</goal>

View File

@ -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] [flake8]
max-line-length=99 max-line-length=99

View File

@ -1,5 +1,3 @@
coverage>=4.0.3 pytest~=4.6.7 # needed for python 2.7+3.4
nose>=1.3.7 pytest-cov>=2.8.1
pluggy>=0.3.1 pytest-randomly==1.2.3 # needed for python 2.7+3.4
py>=1.4.31
randomize>=0.13

View File

@ -11,17 +11,16 @@ export LANG=en_US.UTF-8
### set virtualenv ### set virtualenv
if [ -z "$VIRTUAL_ENV" ]; then 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 source $VENV/bin/activate
DEACTIVE=true DEACTIVE=true
fi fi
### install dependencies ### install dependencies
pip install -r $REQUIREMENTS_FILE | tee -a $REQUIREMENTS_OUT pip install -r $REQUIREMENTS_FILE | tee -a $REQUIREMENTS_OUT
python setup.py develop
### run tests ### run tests
nosetests || exit 1 tox -e py27 || exit 1
### static analysis of code ### static analysis of code
flake8 --show-source petstore_api/ flake8 --show-source petstore_api/
@ -30,4 +29,3 @@ flake8 --show-source petstore_api/
#if [ $DEACTIVE == true ]; then #if [ $DEACTIVE == true ]; then
# deactivate # deactivate
#fi #fi

View File

@ -18,7 +18,6 @@ fi
### install dependencies ### install dependencies
pip install -r $REQUIREMENTS_FILE | tee -a $REQUIREMENTS_OUT pip install -r $REQUIREMENTS_FILE | tee -a $REQUIREMENTS_OUT
python setup.py develop
### run tests ### run tests
tox || exit 1 tox || exit 1

View File

@ -157,7 +157,7 @@ class PetApiTests(unittest.TestCase):
response = thread.get() response = thread.get()
response2 = thread2.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) self.assertIsNotNone(response2.id, self.pet.id)
def test_async_with_http_info(self): def test_async_with_http_info(self):
@ -167,7 +167,7 @@ class PetApiTests(unittest.TestCase):
data, status, headers = thread.get() data, status, headers = thread.get()
self.assertIsInstance(data, petstore_api.Pet) self.assertIsInstance(data, petstore_api.Pet)
self.assertEquals(status, 200) self.assertEqual(status, 200)
def test_async_exception(self): def test_async_exception(self):
self.pet_api.add_pet(self.pet) self.pet_api.add_pet(self.pet)

View File

@ -6,5 +6,4 @@ deps=-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt -r{toxinidir}/test-requirements.txt
commands= commands=
nosetests \ pytest --cov=petstore_api
[]

View File

@ -45,7 +45,9 @@ coverage.xml
*,cover *,cover
.hypothesis/ .hypothesis/
venv/ venv/
.venv/
.python-version .python-version
.pytest_cache
# Translations # Translations
*.mo *.mo

View File

@ -0,0 +1,2 @@
tox
flake8

View File

@ -27,7 +27,7 @@
<version>1.2.1</version> <version>1.2.1</version>
<executions> <executions>
<execution> <execution>
<id>nose-test</id> <id>test</id>
<phase>integration-test</phase> <phase>integration-test</phase>
<goals> <goals>
<goal>exec</goal> <goal>exec</goal>

View File

@ -0,0 +1,2 @@
[flake8]
max-line-length=99

View File

@ -1,5 +1,3 @@
coverage>=4.0.3 pytest~=4.6.7 # needed for python 2.7+3.4
nose>=1.3.7 pytest-cov>=2.8.1
pluggy>=0.3.1 pytest-randomly==1.2.3 # needed for python 2.7+3.4
py>=1.4.31
randomize>=0.13

View File

@ -18,10 +18,9 @@ fi
### install dependencies ### install dependencies
pip install -r $REQUIREMENTS_FILE | tee -a $REQUIREMENTS_OUT pip install -r $REQUIREMENTS_FILE | tee -a $REQUIREMENTS_OUT
python setup.py develop
### run tests ### run tests
nosetests || exit 1 tox -e py27 || exit 1
### static analysis of code ### static analysis of code
flake8 --show-source petstore_api/ flake8 --show-source petstore_api/

View File

@ -18,7 +18,6 @@ fi
### install dependencies ### install dependencies
pip install -r $REQUIREMENTS_FILE | tee -a $REQUIREMENTS_OUT pip install -r $REQUIREMENTS_FILE | tee -a $REQUIREMENTS_OUT
python setup.py develop
### run tests ### run tests
tox || exit 1 tox || exit 1

View File

@ -6,5 +6,4 @@ deps=-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt -r{toxinidir}/test-requirements.txt
commands= commands=
nosetests \ pytest --cov=petstore_api
[]

View File

@ -45,7 +45,9 @@ coverage.xml
*,cover *,cover
.hypothesis/ .hypothesis/
venv/ venv/
.venv/
.python-version .python-version
.pytest_cache
# Translations # Translations
*.mo *.mo

View File

@ -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 swagger-ui-bundle >= 0.0.2
python_dateutil >= 2.6.0 python_dateutil >= 2.6.0
typing >= 3.5.2.2 typing >= 3.5.2.2

View File

@ -1,6 +1,4 @@
flask_testing==0.6.1 pytest~=4.6.7 # needed for python 2.7+3.4
coverage>=4.0.3 pytest-cov>=2.8.1
nose>=1.3.7 pytest-randomly==1.2.3 # needed for python 2.7+3.4
pluggy>=0.3.1 flask_testing==0.6.1
py>=1.4.31
randomize>=0.13

View File

@ -6,5 +6,4 @@ deps=-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt -r{toxinidir}/test-requirements.txt
commands= commands=
nosetests \ pytest --cov=openapi_server
[]

View File

@ -45,7 +45,9 @@ coverage.xml
*,cover *,cover
.hypothesis/ .hypothesis/
venv/ venv/
.venv/
.python-version .python-version
.pytest_cache
# Translations # Translations
*.mo *.mo

View File

@ -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 swagger-ui-bundle >= 0.0.2
python_dateutil >= 2.6.0 python_dateutil >= 2.6.0
setuptools >= 21.0.0 setuptools >= 21.0.0

View File

@ -1,6 +1,4 @@
flask_testing==0.6.1 pytest~=4.6.7 # needed for python 2.7+3.4
coverage>=4.0.3 pytest-cov>=2.8.1
nose>=1.3.7 pytest-randomly==1.2.3 # needed for python 2.7+3.4
pluggy>=0.3.1 flask_testing==0.6.1
py>=1.4.31
randomize>=0.13

View File

@ -6,5 +6,4 @@ deps=-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt -r{toxinidir}/test-requirements.txt
commands= commands=
nosetests \ pytest --cov=openapi_server
[]

View File

@ -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

View File

@ -0,0 +1,2 @@
tox
flake8

View File

@ -27,7 +27,7 @@
<version>1.2.1</version> <version>1.2.1</version>
<executions> <executions>
<execution> <execution>
<id>pytest-test</id> <id>test</id>
<phase>integration-test</phase> <phase>integration-test</phase>
<goals> <goals>
<goal>exec</goal> <goal>exec</goal>

View File

@ -1,6 +1,4 @@
coverage>=4.0.3 pytest~=4.6.7 # needed for python 2.7+3.4
pytest>=1.3.7 pytest-cov>=2.8.1
pluggy>=0.3.1 pytest-randomly==1.2.3 # needed for python 2.7+3.4
py>=1.4.31
randomize>=0.13
pytest-aiohttp>=0.3.0 pytest-aiohttp>=0.3.0

View File

@ -1,8 +1,7 @@
#!/bin/bash #!/bin/bash
REQUIREMENTS_FILE=requirements.txt REQUIREMENTS_FILE=dev-requirements.txt
TEST_REQUIREMENTS_FILE=test-requirements.txt REQUIREMENTS_OUT=dev-requirements.txt.log
REQUIREMENTS_OUT=requirements.txt.log
SETUP_OUT=*.egg-info SETUP_OUT=*.egg-info
VENV=.venv VENV=.venv
DEACTIVE=false DEACTIVE=false
@ -12,16 +11,16 @@ export LANG=en_US.UTF-8
### set virtualenv ### set virtualenv
if [ -z "$VIRTUAL_ENV" ]; then 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 source $VENV/bin/activate
DEACTIVE=true DEACTIVE=true
fi fi
### install dependencies ### 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 ### run tests
pytest || exit 1 tox || exit 1
### static analysis of code ### static analysis of code
flake8 --show-source petstore_api/ flake8 --show-source petstore_api/

View File

@ -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

View File

@ -1 +1 @@
4.0.0 4.2.3-SNAPSHOT

View File

@ -46,6 +46,7 @@ coverage.xml
.hypothesis/ .hypothesis/
venv/ venv/
.python-version .python-version
.pytest_cache
# Translations # Translations
*.mo *.mo

View File

@ -1,6 +1,4 @@
flask_testing==0.6.1 pytest~=4.6.7 # needed for python 2.7+3.4
coverage>=4.0.3 pytest-cov>=2.8.1
nose>=1.3.7 pytest-randomly==1.2.3 # needed for python 2.7+3.4
pluggy>=0.3.1 flask_testing==0.6.1
py>=1.4.31
randomize>=0.13

View File

@ -6,5 +6,4 @@ deps=-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt -r{toxinidir}/test-requirements.txt
commands= commands=
nosetests \ pytest --cov=openapi_server
[]

View File

@ -45,7 +45,9 @@ coverage.xml
*,cover *,cover
.hypothesis/ .hypothesis/
venv/ venv/
.venv/
.python-version .python-version
.pytest_cache
# Translations # Translations
*.mo *.mo

View File

@ -0,0 +1,2 @@
tox
flake8

View File

@ -27,7 +27,7 @@
<version>1.2.1</version> <version>1.2.1</version>
<executions> <executions>
<execution> <execution>
<id>nose-test</id> <id>test</id>
<phase>integration-test</phase> <phase>integration-test</phase>
<goals> <goals>
<goal>exec</goal> <goal>exec</goal>

View File

@ -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 swagger-ui-bundle >= 0.0.2
python_dateutil >= 2.6.0 python_dateutil >= 2.6.0
typing >= 3.5.2.2 typing >= 3.5.2.2

View File

@ -1,6 +1,4 @@
flask_testing==0.6.1 pytest~=4.6.7 # needed for python 2.7+3.4
coverage>=4.0.3 pytest-cov>=2.8.1
nose>=1.3.7 pytest-randomly==1.2.3 # needed for python 2.7+3.4
pluggy>=0.3.1 flask_testing==0.6.1
py>=1.4.31
randomize>=0.13

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
REQUIREMENTS_FILE=test-requirements.txt REQUIREMENTS_FILE=dev-requirements.txt
REQUIREMENTS_OUT=test-requirements.txt.log REQUIREMENTS_OUT=dev-requirements.txt.log
SETUP_OUT=*.egg-info SETUP_OUT=*.egg-info
VENV=.venv VENV=.venv
DEACTIVE=false DEACTIVE=false
@ -18,15 +18,14 @@ fi
### install dependencies ### install dependencies
pip install -r $REQUIREMENTS_FILE | tee -a $REQUIREMENTS_OUT pip install -r $REQUIREMENTS_FILE | tee -a $REQUIREMENTS_OUT
python setup.py develop
### run tests ### run tests
tox || exit 1 tox -e py27 || exit 1
### static analysis of code ### static analysis of code
flake8 --show-source petstore_api/ flake8 --show-source petstore_api/
### deactivate virtualenv ### deactivate virtualenv
#if [ $DEACTIVE == true ]; then # if [ $DEACTIVE == true ]; then
# deactivate # deactivate
#fi # fi

View File

@ -6,5 +6,4 @@ deps=-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt -r{toxinidir}/test-requirements.txt
commands= commands=
nosetests \ pytest --cov=openapi_server
[]

View File

@ -45,7 +45,9 @@ coverage.xml
*,cover *,cover
.hypothesis/ .hypothesis/
venv/ venv/
.venv/
.python-version .python-version
.pytest_cache
# Translations # Translations
*.mo *.mo

View File

@ -0,0 +1,2 @@
tox
flake8

View File

@ -27,7 +27,7 @@
<version>1.2.1</version> <version>1.2.1</version>
<executions> <executions>
<execution> <execution>
<id>nose-test</id> <id>test</id>
<phase>integration-test</phase> <phase>integration-test</phase>
<goals> <goals>
<goal>exec</goal> <goal>exec</goal>

View File

@ -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 swagger-ui-bundle >= 0.0.2
python_dateutil >= 2.6.0 python_dateutil >= 2.6.0
setuptools >= 21.0.0 setuptools >= 21.0.0

View File

@ -1,6 +1,4 @@
flask_testing==0.6.1 pytest~=4.6.7 # needed for python 2.7+3.4
coverage>=4.0.3 pytest-cov>=2.8.1
nose>=1.3.7 pytest-randomly==1.2.3 # needed for python 2.7+3.4
pluggy>=0.3.1 flask_testing==0.6.1
py>=1.4.31
randomize>=0.13

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
REQUIREMENTS_FILE=test-requirements.txt REQUIREMENTS_FILE=dev-requirements.txt
REQUIREMENTS_OUT=test-requirements.txt.log REQUIREMENTS_OUT=dev-requirements.txt.log
SETUP_OUT=*.egg-info SETUP_OUT=*.egg-info
VENV=.venv VENV=.venv
DEACTIVE=false DEACTIVE=false
@ -18,7 +18,6 @@ fi
### install dependencies ### install dependencies
pip install -r $REQUIREMENTS_FILE | tee -a $REQUIREMENTS_OUT pip install -r $REQUIREMENTS_FILE | tee -a $REQUIREMENTS_OUT
python setup.py develop
### run tests ### run tests
tox || exit 1 tox || exit 1
@ -27,6 +26,6 @@ tox || exit 1
flake8 --show-source petstore_api/ flake8 --show-source petstore_api/
### deactivate virtualenv ### deactivate virtualenv
#if [ $DEACTIVE == true ]; then # if [ $DEACTIVE == true ]; then
# deactivate # deactivate
#fi # fi

View File

@ -6,5 +6,4 @@ deps=-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt -r{toxinidir}/test-requirements.txt
commands= commands=
nosetests \ pytest --cov=openapi_server
[]