Minor testing-related cleanup
* Move docs dependencies out of test-requirements.txt * Eliminate python version specific test (py35) * Re-order default envlist to shorten feedback cycle * Minor whitespace changes * Simplify versions unit test * Add /.cache to .gitignore * Include tests directory in basic format requirements, but not flake8 * Fix sample noauth-api-paste.ini config Change-Id: I440f5c2d988098287f9914449f7103735f832192
This commit is contained in:
parent
4a0b8f30b2
commit
b9dceb2a9a
1
.gitignore
vendored
1
.gitignore
vendored
@ -7,6 +7,7 @@
|
|||||||
/charts/*/requirements.lock
|
/charts/*/requirements.lock
|
||||||
|
|
||||||
# Build & test artifacts
|
# Build & test artifacts
|
||||||
|
/.cache
|
||||||
/.eggs
|
/.eggs
|
||||||
/.helm-pid
|
/.helm-pid
|
||||||
/.tox
|
/.tox
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
[filter:noauth]
|
[filter:noauth]
|
||||||
forged_roles = admin
|
forged_roles = admin
|
||||||
paste.filter_factory = promenade.control.middleware:no_auth_filter_factory
|
paste.filter_factory = promenade.control.middleware:noauth_filter_factory
|
||||||
|
|
||||||
[app:promenade-api]
|
[app:promenade-api]
|
||||||
disable = keystone
|
disable = keystone
|
||||||
|
@ -1,4 +1 @@
|
|||||||
# Documentation
|
|
||||||
pytest
|
pytest
|
||||||
sphinx>=1.6.2
|
|
||||||
sphinx_rtd_theme==0.2.4
|
|
||||||
|
@ -1,3 +1,17 @@
|
|||||||
|
# Copyright 2017 AT&T Intellectual Property. All other rights reserved.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
import falcon
|
import falcon
|
||||||
from falcon import testing
|
from falcon import testing
|
||||||
import pytest
|
import pytest
|
||||||
@ -10,6 +24,7 @@ from promenade.promenade import promenade
|
|||||||
def client():
|
def client():
|
||||||
return testing.TestClient(promenade)
|
return testing.TestClient(promenade)
|
||||||
|
|
||||||
|
|
||||||
def test_get_health(client):
|
def test_get_health(client):
|
||||||
response = client.simulate_get('/api/v1.0/health')
|
response = client.simulate_get('/api/v1.0/health')
|
||||||
assert response.status == falcon.HTTP_204
|
assert response.status == falcon.HTTP_204
|
||||||
|
@ -1,3 +1,17 @@
|
|||||||
|
# Copyright 2017 AT&T Intellectual Property. All other rights reserved.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
import falcon
|
import falcon
|
||||||
from falcon import testing
|
from falcon import testing
|
||||||
import pytest
|
import pytest
|
||||||
@ -10,9 +24,8 @@ from promenade.promenade import promenade
|
|||||||
def client():
|
def client():
|
||||||
return testing.TestClient(promenade)
|
return testing.TestClient(promenade)
|
||||||
|
|
||||||
|
|
||||||
def test_get_versions(client):
|
def test_get_versions(client):
|
||||||
response = client.simulate_get('/versions')
|
response = client.simulate_get('/versions')
|
||||||
assert response.status == falcon.HTTP_200
|
assert response.status == falcon.HTTP_200
|
||||||
body = response.content.decode('utf-8')
|
assert response.json == {'v1.0': {'path': '/api/v1.0', 'status': 'stable'}}
|
||||||
assert '"path": "/api/v1.0"' in body
|
|
||||||
assert '"status": "stable"' in body
|
|
||||||
|
28
tox.ini
28
tox.ini
@ -1,18 +1,13 @@
|
|||||||
[tox]
|
[tox]
|
||||||
envlist = py35,unit,bandit,lint,docs
|
envlist = lint,unit,bandit,docs
|
||||||
|
|
||||||
[testenv]
|
|
||||||
setenv=
|
|
||||||
PYTHONWARNING=all
|
|
||||||
commands=
|
|
||||||
pytest \
|
|
||||||
{posargs}
|
|
||||||
deps = -r{toxinidir}/requirements-frozen.txt
|
|
||||||
-r{toxinidir}/test-requirements.txt
|
|
||||||
|
|
||||||
[testenv:unit]
|
[testenv:unit]
|
||||||
|
setenv =
|
||||||
|
PYTHONWARNING=all
|
||||||
|
deps = -r{toxinidir}/requirements-frozen.txt
|
||||||
|
-r{toxinidir}/test-requirements.txt
|
||||||
commands =
|
commands =
|
||||||
pytest tests/unit
|
pytest
|
||||||
|
|
||||||
[testenv:bandit]
|
[testenv:bandit]
|
||||||
deps = bandit==1.4.0
|
deps = bandit==1.4.0
|
||||||
@ -20,7 +15,10 @@ commands =
|
|||||||
bandit -r promenade
|
bandit -r promenade
|
||||||
|
|
||||||
[testenv:docs]
|
[testenv:docs]
|
||||||
whitelist_externals=rm
|
whitelist_externals = rm
|
||||||
|
deps =
|
||||||
|
sphinx>=1.6.2
|
||||||
|
sphinx_rtd_theme==0.2.4
|
||||||
commands =
|
commands =
|
||||||
rm -rf docs/build
|
rm -rf docs/build
|
||||||
python setup.py build_sphinx {posargs}
|
python setup.py build_sphinx {posargs}
|
||||||
@ -28,12 +26,12 @@ commands =
|
|||||||
[testenv:fmt]
|
[testenv:fmt]
|
||||||
deps = yapf==0.20.0
|
deps = yapf==0.20.0
|
||||||
commands =
|
commands =
|
||||||
yapf -ir {toxinidir}/promenade
|
yapf -ir {toxinidir}/promenade {toxinidir}/tests
|
||||||
|
|
||||||
[testenv:freeze]
|
[testenv:freeze]
|
||||||
deps = -r{toxinidir}/requirements-direct.txt
|
deps = -r{toxinidir}/requirements-direct.txt
|
||||||
recreate = True
|
recreate = True
|
||||||
whitelist_externals=sh
|
whitelist_externals = sh
|
||||||
commands=
|
commands=
|
||||||
sh -c "pip freeze | grep -v '^promenade' > {toxinidir}/requirements-frozen.txt"
|
sh -c "pip freeze | grep -v '^promenade' > {toxinidir}/requirements-frozen.txt"
|
||||||
|
|
||||||
@ -49,5 +47,5 @@ deps =
|
|||||||
yapf==0.20.0
|
yapf==0.20.0
|
||||||
flake8==3.5.0
|
flake8==3.5.0
|
||||||
commands =
|
commands =
|
||||||
yapf -rd {toxinidir}/promenade
|
yapf -rd {toxinidir}/promenade {toxinidir}/tests
|
||||||
flake8 {toxinidir}/promenade
|
flake8 {toxinidir}/promenade
|
||||||
|
Loading…
x
Reference in New Issue
Block a user