Add a basic test framework for oslo.metrics

Add a noop test as a basic test framework.
Properly comment out the bandit line to not give the impression that
it's actually tested (it was misconfigured before).

Change-Id: Ic2278816d50ec0fa628f6616839f8b9dc0a5c299
This commit is contained in:
Thierry Carrez 2020-09-16 17:23:34 +02:00
parent 274e5bff6e
commit d9c4bc5eba
4 changed files with 38 additions and 6 deletions

3
.stestr.conf Normal file
View File

@ -0,0 +1,3 @@
[DEFAULT]
test_path=./oslo_metrics/tests
top_path=./

View File

View File

@ -0,0 +1,30 @@
# -*- coding: utf-8 -*-
# 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.
"""
test_noop
----------------------------------
A test that always reports success.
"""
from oslotest import base
class TestNoop(base.BaseTestCase):
def setUp(self):
super(TestNoop, self).setUp()
def test_always_success(self):
self.assertEqual(1, 1)

11
tox.ini
View File

@ -10,17 +10,16 @@ whitelist_externals =
deps =
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/test-requirements.txt
# NOTE(hberaud): Not yet activated
#commands =
# find . -type f -name "*.pyc" -delete
# stestr run --slowest {posargs}
commands =
find . -type f -name "*.pyc" -delete
stestr run --slowest {posargs}
[testenv:pep8]
deps = {[testenv]deps}
commands =
flake8
# Run security linter
bandit -r oslo_cache -x tests -n5
# Run security linter (deactivated as it fails on tmpdir issue right now)
# bandit -r oslo_metrics -x tests -n5
[testenv:venv]
commands = {posargs}