From 385310e1b03dbf13c44bd8c95780c147cac4a526 Mon Sep 17 00:00:00 2001 From: Chris Dent Date: Tue, 11 Dec 2018 11:36:57 +0000 Subject: [PATCH] Initial automated testing for os-resource-classes Adjust tox settings for a reasonable set of job defaults. Turn on the usual templates in .zuul.yaml Correct small pep8 and docs issues to get tox jobs passing. Change-Id: Id0ebeab2ec2439d52defe59096b07c3d0b7bc66d --- .zuul.yaml | 10 ++++++++++ README.rst | 1 + os_resource_classes/__init__.py | 12 ++++++++++++ .../tests/test_os_resource_classes.py | 10 ++++------ tox.ini | 2 +- 5 files changed, 28 insertions(+), 7 deletions(-) create mode 100644 .zuul.yaml diff --git a/.zuul.yaml b/.zuul.yaml new file mode 100644 index 0000000..c5b04b6 --- /dev/null +++ b/.zuul.yaml @@ -0,0 +1,10 @@ +- project: + templates: + - check-requirements + - openstack-cover-jobs + - openstack-python-jobs + - openstack-python35-jobs + - openstack-python36-jobs + - openstack-python37-jobs + - publish-openstack-docs-pti + - release-notes-jobs-python3 diff --git a/README.rst b/README.rst index 89f2f8e..108de29 100644 --- a/README.rst +++ b/README.rst @@ -12,6 +12,7 @@ A list of standardized resource classes for OpenStack. * Documentation: https://docs.openstack.org/os-resource-classes/latest * Source: https://git.openstack.org/cgit/openstack/os-resource-classes * Bugs: https://bugs.launchpad.net/nova + -------- * TODO diff --git a/os_resource_classes/__init__.py b/os_resource_classes/__init__.py index 5eb4c24..e908223 100644 --- a/os_resource_classes/__init__.py +++ b/os_resource_classes/__init__.py @@ -1,3 +1,14 @@ +# 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. """Static symbols for resources classes used by OpenStack. A resource class is a type of countable thing that exists in @@ -47,6 +58,7 @@ ORDERED_CLASSES = [ # Namespace used for custom resource classes CUSTOM_NAMESPACE = 'CUSTOM_' + def is_custom(resource_class): return resource_class.startswith(CUSTOM_NAMESPACE) diff --git a/os_resource_classes/tests/test_os_resource_classes.py b/os_resource_classes/tests/test_os_resource_classes.py index ac50087..8327695 100644 --- a/os_resource_classes/tests/test_os_resource_classes.py +++ b/os_resource_classes/tests/test_os_resource_classes.py @@ -1,5 +1,3 @@ -# -*- 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 @@ -26,9 +24,9 @@ from os_resource_classes.tests import base class TestOs_resource_classes(base.TestCase): def test_id_mapping_strings(self): - self.assertEqual('VCPU', rc.ORDERED_CLASSES[0]) - self.assertEqual('DISK_GB', rc.ORDERED_CLASSES[2]) + self.assertEqual('VCPU', rc.ORDERED_CLASSES[0]) + self.assertEqual('DISK_GB', rc.ORDERED_CLASSES[2]) def test_id_mapping_symbols(self): - self.assertEqual(rc.VCPU, rc.ORDERED_CLASSES[0]) - self.assertEqual(rc.DISK_GB, rc.ORDERED_CLASSES[2]) + self.assertEqual(rc.VCPU, rc.ORDERED_CLASSES[0]) + self.assertEqual(rc.DISK_GB, rc.ORDERED_CLASSES[2]) diff --git a/tox.ini b/tox.ini index 00ae985..6c9ed92 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] minversion = 2.0 -envlist = py35,py27,pep8 +envlist = py36,py27,pep8 skipsdist = True [testenv]