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
|
||||
|
||||
# Build & test artifacts
|
||||
/.cache
|
||||
/.eggs
|
||||
/.helm-pid
|
||||
/.tox
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
[filter:noauth]
|
||||
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]
|
||||
disable = keystone
|
||||
|
@ -1,4 +1 @@
|
||||
# Documentation
|
||||
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
|
||||
from falcon import testing
|
||||
import pytest
|
||||
@ -10,6 +24,7 @@ from promenade.promenade import promenade
|
||||
def client():
|
||||
return testing.TestClient(promenade)
|
||||
|
||||
|
||||
def test_get_health(client):
|
||||
response = client.simulate_get('/api/v1.0/health')
|
||||
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
|
||||
from falcon import testing
|
||||
import pytest
|
||||
@ -10,9 +24,8 @@ from promenade.promenade import promenade
|
||||
def client():
|
||||
return testing.TestClient(promenade)
|
||||
|
||||
|
||||
def test_get_versions(client):
|
||||
response = client.simulate_get('/versions')
|
||||
assert response.status == falcon.HTTP_200
|
||||
body = response.content.decode('utf-8')
|
||||
assert '"path": "/api/v1.0"' in body
|
||||
assert '"status": "stable"' in body
|
||||
assert response.json == {'v1.0': {'path': '/api/v1.0', 'status': 'stable'}}
|
||||
|
28
tox.ini
28
tox.ini
@ -1,18 +1,13 @@
|
||||
[tox]
|
||||
envlist = py35,unit,bandit,lint,docs
|
||||
|
||||
[testenv]
|
||||
setenv=
|
||||
PYTHONWARNING=all
|
||||
commands=
|
||||
pytest \
|
||||
{posargs}
|
||||
deps = -r{toxinidir}/requirements-frozen.txt
|
||||
-r{toxinidir}/test-requirements.txt
|
||||
envlist = lint,unit,bandit,docs
|
||||
|
||||
[testenv:unit]
|
||||
setenv =
|
||||
PYTHONWARNING=all
|
||||
deps = -r{toxinidir}/requirements-frozen.txt
|
||||
-r{toxinidir}/test-requirements.txt
|
||||
commands =
|
||||
pytest tests/unit
|
||||
pytest
|
||||
|
||||
[testenv:bandit]
|
||||
deps = bandit==1.4.0
|
||||
@ -20,7 +15,10 @@ commands =
|
||||
bandit -r promenade
|
||||
|
||||
[testenv:docs]
|
||||
whitelist_externals=rm
|
||||
whitelist_externals = rm
|
||||
deps =
|
||||
sphinx>=1.6.2
|
||||
sphinx_rtd_theme==0.2.4
|
||||
commands =
|
||||
rm -rf docs/build
|
||||
python setup.py build_sphinx {posargs}
|
||||
@ -28,12 +26,12 @@ commands =
|
||||
[testenv:fmt]
|
||||
deps = yapf==0.20.0
|
||||
commands =
|
||||
yapf -ir {toxinidir}/promenade
|
||||
yapf -ir {toxinidir}/promenade {toxinidir}/tests
|
||||
|
||||
[testenv:freeze]
|
||||
deps = -r{toxinidir}/requirements-direct.txt
|
||||
recreate = True
|
||||
whitelist_externals=sh
|
||||
whitelist_externals = sh
|
||||
commands=
|
||||
sh -c "pip freeze | grep -v '^promenade' > {toxinidir}/requirements-frozen.txt"
|
||||
|
||||
@ -49,5 +47,5 @@ deps =
|
||||
yapf==0.20.0
|
||||
flake8==3.5.0
|
||||
commands =
|
||||
yapf -rd {toxinidir}/promenade
|
||||
yapf -rd {toxinidir}/promenade {toxinidir}/tests
|
||||
flake8 {toxinidir}/promenade
|
||||
|
Loading…
x
Reference in New Issue
Block a user