From d9c4bc5eba026aa35478c92f2c27f33b1c43ae71 Mon Sep 17 00:00:00 2001 From: Thierry Carrez Date: Wed, 16 Sep 2020 17:23:34 +0200 Subject: [PATCH] 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 --- .stestr.conf | 3 +++ oslo_metrics/tests/__init__.py | 0 oslo_metrics/tests/test_noop.py | 30 ++++++++++++++++++++++++++++++ tox.ini | 11 +++++------ 4 files changed, 38 insertions(+), 6 deletions(-) create mode 100644 .stestr.conf create mode 100644 oslo_metrics/tests/__init__.py create mode 100644 oslo_metrics/tests/test_noop.py diff --git a/.stestr.conf b/.stestr.conf new file mode 100644 index 0000000..507bc35 --- /dev/null +++ b/.stestr.conf @@ -0,0 +1,3 @@ +[DEFAULT] +test_path=./oslo_metrics/tests +top_path=./ diff --git a/oslo_metrics/tests/__init__.py b/oslo_metrics/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/oslo_metrics/tests/test_noop.py b/oslo_metrics/tests/test_noop.py new file mode 100644 index 0000000..9f32cad --- /dev/null +++ b/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) diff --git a/tox.ini b/tox.ini index 058aea2..57cb671 100644 --- a/tox.ini +++ b/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}