From 33483b2f205279cbfa7f8e34a7ad64bdc31aab0c Mon Sep 17 00:00:00 2001 From: LoveIsGrief Date: Thu, 20 Feb 2020 14:47:13 +0100 Subject: [PATCH] Respect usenose for Python CI (#5376) * python: Respect useNose option in generated CI templates Travis and Gitlab CI now use nosetests or pytests depending on the "useNose" option that is passed. * python: Update CI samples They now respect the "useNose" option --- .../src/main/resources/python/gitlab-ci.mustache | 7 ++++++- .../src/main/resources/python/travis.mustache | 9 ++++++++- samples/client/petstore/python-asyncio/.gitlab-ci.yml | 4 ++-- samples/client/petstore/python-asyncio/.travis.yml | 6 ++++-- .../client/petstore/python-experimental/.gitlab-ci.yml | 4 ++-- samples/client/petstore/python-experimental/.travis.yml | 6 ++++-- samples/client/petstore/python-tornado/.gitlab-ci.yml | 4 ++-- samples/client/petstore/python-tornado/.travis.yml | 6 ++++-- samples/client/petstore/python/.gitlab-ci.yml | 4 ++-- samples/client/petstore/python/.travis.yml | 6 ++++-- .../client/petstore/python-experimental/.gitlab-ci.yml | 4 ++-- .../client/petstore/python-experimental/.travis.yml | 6 ++++-- samples/openapi3/client/petstore/python/.gitlab-ci.yml | 4 ++-- samples/openapi3/client/petstore/python/.travis.yml | 6 ++++-- 14 files changed, 50 insertions(+), 26 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/python/gitlab-ci.mustache b/modules/openapi-generator/src/main/resources/python/gitlab-ci.mustache index 28046fefa0c..2cabff63c78 100644 --- a/modules/openapi-generator/src/main/resources/python/gitlab-ci.mustache +++ b/modules/openapi-generator/src/main/resources/python/gitlab-ci.mustache @@ -7,8 +7,13 @@ stages: stage: test script: - pip install -r requirements.txt - - pip install nose + - pip install -r test-requirements.txt + {{#useNose}} - nosetests + {{/useNose}} + {{^useNose}} + - pytest --cov={{{packageName}}} + {{/useNose}} nosetest-2.7: extends: .nosetest diff --git a/modules/openapi-generator/src/main/resources/python/travis.mustache b/modules/openapi-generator/src/main/resources/python/travis.mustache index 388de83128f..195488737d6 100644 --- a/modules/openapi-generator/src/main/resources/python/travis.mustache +++ b/modules/openapi-generator/src/main/resources/python/travis.mustache @@ -10,6 +10,13 @@ python: - "3.7" - "3.8" # command to install dependencies -install: "pip install -r requirements.txt" +install: + - "pip install -r requirements.txt" + - "pip install -r test-requirements.txt" # command to run tests +{{#useNose}} script: nosetests +{{/useNose}} +{{^useNose}} +script: pytest --cov={{{packageName}}} +{{/useNose}} diff --git a/samples/client/petstore/python-asyncio/.gitlab-ci.yml b/samples/client/petstore/python-asyncio/.gitlab-ci.yml index 28046fefa0c..142ce3712ed 100644 --- a/samples/client/petstore/python-asyncio/.gitlab-ci.yml +++ b/samples/client/petstore/python-asyncio/.gitlab-ci.yml @@ -7,8 +7,8 @@ stages: stage: test script: - pip install -r requirements.txt - - pip install nose - - nosetests + - pip install -r test-requirements.txt + - pytest --cov=petstore_api nosetest-2.7: extends: .nosetest diff --git a/samples/client/petstore/python-asyncio/.travis.yml b/samples/client/petstore/python-asyncio/.travis.yml index 388de83128f..fcd7e31c7cc 100644 --- a/samples/client/petstore/python-asyncio/.travis.yml +++ b/samples/client/petstore/python-asyncio/.travis.yml @@ -10,6 +10,8 @@ python: - "3.7" - "3.8" # command to install dependencies -install: "pip install -r requirements.txt" +install: + - "pip install -r requirements.txt" + - "pip install -r test-requirements.txt" # command to run tests -script: nosetests +script: pytest --cov=petstore_api diff --git a/samples/client/petstore/python-experimental/.gitlab-ci.yml b/samples/client/petstore/python-experimental/.gitlab-ci.yml index 28046fefa0c..142ce3712ed 100644 --- a/samples/client/petstore/python-experimental/.gitlab-ci.yml +++ b/samples/client/petstore/python-experimental/.gitlab-ci.yml @@ -7,8 +7,8 @@ stages: stage: test script: - pip install -r requirements.txt - - pip install nose - - nosetests + - pip install -r test-requirements.txt + - pytest --cov=petstore_api nosetest-2.7: extends: .nosetest diff --git a/samples/client/petstore/python-experimental/.travis.yml b/samples/client/petstore/python-experimental/.travis.yml index 388de83128f..fcd7e31c7cc 100644 --- a/samples/client/petstore/python-experimental/.travis.yml +++ b/samples/client/petstore/python-experimental/.travis.yml @@ -10,6 +10,8 @@ python: - "3.7" - "3.8" # command to install dependencies -install: "pip install -r requirements.txt" +install: + - "pip install -r requirements.txt" + - "pip install -r test-requirements.txt" # command to run tests -script: nosetests +script: pytest --cov=petstore_api diff --git a/samples/client/petstore/python-tornado/.gitlab-ci.yml b/samples/client/petstore/python-tornado/.gitlab-ci.yml index 28046fefa0c..142ce3712ed 100644 --- a/samples/client/petstore/python-tornado/.gitlab-ci.yml +++ b/samples/client/petstore/python-tornado/.gitlab-ci.yml @@ -7,8 +7,8 @@ stages: stage: test script: - pip install -r requirements.txt - - pip install nose - - nosetests + - pip install -r test-requirements.txt + - pytest --cov=petstore_api nosetest-2.7: extends: .nosetest diff --git a/samples/client/petstore/python-tornado/.travis.yml b/samples/client/petstore/python-tornado/.travis.yml index 388de83128f..fcd7e31c7cc 100644 --- a/samples/client/petstore/python-tornado/.travis.yml +++ b/samples/client/petstore/python-tornado/.travis.yml @@ -10,6 +10,8 @@ python: - "3.7" - "3.8" # command to install dependencies -install: "pip install -r requirements.txt" +install: + - "pip install -r requirements.txt" + - "pip install -r test-requirements.txt" # command to run tests -script: nosetests +script: pytest --cov=petstore_api diff --git a/samples/client/petstore/python/.gitlab-ci.yml b/samples/client/petstore/python/.gitlab-ci.yml index 28046fefa0c..142ce3712ed 100644 --- a/samples/client/petstore/python/.gitlab-ci.yml +++ b/samples/client/petstore/python/.gitlab-ci.yml @@ -7,8 +7,8 @@ stages: stage: test script: - pip install -r requirements.txt - - pip install nose - - nosetests + - pip install -r test-requirements.txt + - pytest --cov=petstore_api nosetest-2.7: extends: .nosetest diff --git a/samples/client/petstore/python/.travis.yml b/samples/client/petstore/python/.travis.yml index 388de83128f..fcd7e31c7cc 100644 --- a/samples/client/petstore/python/.travis.yml +++ b/samples/client/petstore/python/.travis.yml @@ -10,6 +10,8 @@ python: - "3.7" - "3.8" # command to install dependencies -install: "pip install -r requirements.txt" +install: + - "pip install -r requirements.txt" + - "pip install -r test-requirements.txt" # command to run tests -script: nosetests +script: pytest --cov=petstore_api diff --git a/samples/openapi3/client/petstore/python-experimental/.gitlab-ci.yml b/samples/openapi3/client/petstore/python-experimental/.gitlab-ci.yml index 28046fefa0c..142ce3712ed 100644 --- a/samples/openapi3/client/petstore/python-experimental/.gitlab-ci.yml +++ b/samples/openapi3/client/petstore/python-experimental/.gitlab-ci.yml @@ -7,8 +7,8 @@ stages: stage: test script: - pip install -r requirements.txt - - pip install nose - - nosetests + - pip install -r test-requirements.txt + - pytest --cov=petstore_api nosetest-2.7: extends: .nosetest diff --git a/samples/openapi3/client/petstore/python-experimental/.travis.yml b/samples/openapi3/client/petstore/python-experimental/.travis.yml index 388de83128f..fcd7e31c7cc 100644 --- a/samples/openapi3/client/petstore/python-experimental/.travis.yml +++ b/samples/openapi3/client/petstore/python-experimental/.travis.yml @@ -10,6 +10,8 @@ python: - "3.7" - "3.8" # command to install dependencies -install: "pip install -r requirements.txt" +install: + - "pip install -r requirements.txt" + - "pip install -r test-requirements.txt" # command to run tests -script: nosetests +script: pytest --cov=petstore_api diff --git a/samples/openapi3/client/petstore/python/.gitlab-ci.yml b/samples/openapi3/client/petstore/python/.gitlab-ci.yml index 28046fefa0c..142ce3712ed 100644 --- a/samples/openapi3/client/petstore/python/.gitlab-ci.yml +++ b/samples/openapi3/client/petstore/python/.gitlab-ci.yml @@ -7,8 +7,8 @@ stages: stage: test script: - pip install -r requirements.txt - - pip install nose - - nosetests + - pip install -r test-requirements.txt + - pytest --cov=petstore_api nosetest-2.7: extends: .nosetest diff --git a/samples/openapi3/client/petstore/python/.travis.yml b/samples/openapi3/client/petstore/python/.travis.yml index 388de83128f..fcd7e31c7cc 100644 --- a/samples/openapi3/client/petstore/python/.travis.yml +++ b/samples/openapi3/client/petstore/python/.travis.yml @@ -10,6 +10,8 @@ python: - "3.7" - "3.8" # command to install dependencies -install: "pip install -r requirements.txt" +install: + - "pip install -r requirements.txt" + - "pip install -r test-requirements.txt" # command to run tests -script: nosetests +script: pytest --cov=petstore_api