Browse Source

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
changes/62/752262/1
Thierry Carrez 1 year ago
parent
commit
d9c4bc5eba
  1. 3
      .stestr.conf
  2. 0
      oslo_metrics/tests/__init__.py
  3. 30
      oslo_metrics/tests/test_noop.py
  4. 11
      tox.ini

3
.stestr.conf

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

0
oslo_metrics/tests/__init__.py

30
oslo_metrics/tests/test_noop.py

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

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

Loading…
Cancel
Save