From dff77df8fc7ac17f2c780f1b5768aa9e92e06308 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Sat, 30 Mar 2024 15:33:04 +0900 Subject: [PATCH] Adapt to recent dependencies This covers the following updates to fix CI currently broken. * Fix compatibility with tox 4 * Update hacking to 6.1.0 * Clean up python 2 support and bump minimum supported version to 3.8 * Remove six because python 2 support is removed * Update job template to use the recent tested python versions * Replace items by prefixItems to fix schema error * Build documentation by sphinx command * Remove "Change Log" section from documentation * Split requirements for documentation build * Ensure tox is installed in functional tests * Fix devstack job Change-Id: I3b9c5b20aca55332c721d34fd4c41c5b886f60c5 --- .zuul.yaml | 4 +- doc/requirements.txt | 5 ++ doc/source/history.rst | 1 - doc/source/index.rst | 8 ---- os_faults/api/cloud_management.py | 4 +- os_faults/api/container.py | 5 +- os_faults/api/human.py | 1 + os_faults/api/node_collection.py | 2 +- os_faults/api/node_discover.py | 5 +- os_faults/api/power_management.py | 5 +- os_faults/api/service.py | 5 +- os_faults/cmd/cmd.py | 2 + os_faults/drivers/shared_schemas.py | 2 +- os_faults/tests/devstack/playbooks/post.yml | 4 +- os_faults/tests/devstack/playbooks/pre.yml | 5 +- .../devstack/playbooks/run_on_devstack.yml | 22 +++++---- os_faults/tests/unit/ansible/test_executor.py | 7 +-- os_faults/tests/unit/api/test_human_api.py | 3 +- .../tests/unit/api/test_node_collection.py | 6 +-- .../tests/unit/api/test_power_management.py | 46 ++++++++++--------- os_faults/tests/unit/cmd/test_cmd.py | 2 +- os_faults/tests/unit/cmd/test_main.py | 2 +- .../tests/unit/drivers/cloud/test_devstack.py | 3 +- .../unit/drivers/cloud/test_saltcloud.py | 3 +- .../unit/drivers/cloud/test_universal.py | 3 +- .../tests/unit/drivers/power/test_ipmi.py | 3 +- .../tests/unit/drivers/power/test_libvirt.py | 3 +- .../unit/drivers/services/test_process.py | 3 +- os_faults/tests/unit/test_os_faults.py | 3 +- os_faults/tests/unit/test_registry.py | 3 +- os_faults/tests/unit/test_utils.py | 5 +- requirements.txt | 16 ++----- setup.cfg | 28 ++++------- test-requirements.txt | 17 +------ tox.ini | 41 ++++++++++------- 35 files changed, 125 insertions(+), 152 deletions(-) create mode 100644 doc/requirements.txt delete mode 100644 doc/source/history.rst diff --git a/.zuul.yaml b/.zuul.yaml index 02d2c1a..59605d4 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -1,9 +1,7 @@ - project: templates: - docs-on-readthedocs - - openstack-python-jobs - - openstack-python36-jobs - - openstack-python37-jobs + - openstack-python3-jobs vars: rtd_webhook_id: '47124' check: diff --git a/doc/requirements.txt b/doc/requirements.txt new file mode 100644 index 0000000..e3110d5 --- /dev/null +++ b/doc/requirements.txt @@ -0,0 +1,5 @@ +openstackdocstheme +sphinx!=1.6.6,!=1.6.7 # BSD +sphinxcontrib-programoutput # BSD +sphinx_rtd_theme # MIT +reno>=1.8.0 # Apache-2.0 diff --git a/doc/source/history.rst b/doc/source/history.rst deleted file mode 100644 index 69ed4fe..0000000 --- a/doc/source/history.rst +++ /dev/null @@ -1 +0,0 @@ -.. include:: ../../ChangeLog diff --git a/doc/source/index.rst b/doc/source/index.rst index a9926d1..10701cc 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -22,14 +22,6 @@ Contents api contributing -Release Notes -============= - -.. toctree:: - :maxdepth: 1 - - history - Indices and Tables ================== diff --git a/os_faults/api/cloud_management.py b/os_faults/api/cloud_management.py index 15fd7fb..280862f 100644 --- a/os_faults/api/cloud_management.py +++ b/os_faults/api/cloud_management.py @@ -16,7 +16,6 @@ import copy import logging import jsonschema -import six from os_faults.api import base_driver from os_faults.api import error @@ -27,8 +26,7 @@ from os_faults import registry LOG = logging.getLogger(__name__) -@six.add_metaclass(abc.ABCMeta) -class CloudManagement(base_driver.BaseDriver): +class CloudManagement(base_driver.BaseDriver, metaclass=abc.ABCMeta): SERVICES = {} CONTAINERS = {} SUPPORTED_NETWORKS = [] diff --git a/os_faults/api/container.py b/os_faults/api/container.py index 1935b64..1e2e845 100644 --- a/os_faults/api/container.py +++ b/os_faults/api/container.py @@ -13,14 +13,11 @@ import abc -import six - from os_faults.api import base_driver from os_faults.api.utils import public -@six.add_metaclass(abc.ABCMeta) -class Container(base_driver.BaseDriver): +class Container(base_driver.BaseDriver, metaclass=abc.ABCMeta): def __init__(self, container_name, config, node_cls, cloud_management, hosts=None): diff --git a/os_faults/api/human.py b/os_faults/api/human.py index 4801dc7..54b45ef 100644 --- a/os_faults/api/human.py +++ b/os_faults/api/human.py @@ -49,6 +49,7 @@ def list_actions(klazz): klazz, predicate=utils.is_public)) + RANDOMNESS = {'one', 'random', 'some', 'single'} ANYTHING = {'all'} NODE_ALIASES_PATTERN = '|'.join(RANDOMNESS | ANYTHING) diff --git a/os_faults/api/node_collection.py b/os_faults/api/node_collection.py index e0a338d..b48e95c 100644 --- a/os_faults/api/node_collection.py +++ b/os_faults/api/node_collection.py @@ -110,7 +110,7 @@ class NodeCollection(utils.ReprMixin): msg = 'Cannot pick {} from {} node(s)'.format( count, len(self._hosts)) raise error.NodeCollectionError(msg) - return self._make_instance(random.sample(self._hosts, count)) + return self._make_instance(random.sample(self.hosts, count)) def filter(self, criteria_fn): hosts = list(filter(criteria_fn, self._hosts)) diff --git a/os_faults/api/node_discover.py b/os_faults/api/node_discover.py index 10f9915..8c2b35f 100644 --- a/os_faults/api/node_discover.py +++ b/os_faults/api/node_discover.py @@ -13,13 +13,10 @@ import abc -import six - from os_faults.api import base_driver -@six.add_metaclass(abc.ABCMeta) -class NodeDiscover(base_driver.BaseDriver): +class NodeDiscover(base_driver.BaseDriver, metaclass=abc.ABCMeta): """Node discover base driver.""" @abc.abstractmethod diff --git a/os_faults/api/power_management.py b/os_faults/api/power_management.py index 0398099..edce945 100644 --- a/os_faults/api/power_management.py +++ b/os_faults/api/power_management.py @@ -13,15 +13,12 @@ import abc -import six - from os_faults.api import base_driver from os_faults.api import error from os_faults import utils -@six.add_metaclass(abc.ABCMeta) -class PowerDriver(base_driver.BaseDriver): +class PowerDriver(base_driver.BaseDriver, metaclass=abc.ABCMeta): @abc.abstractmethod def supports(self, host): diff --git a/os_faults/api/service.py b/os_faults/api/service.py index cc90470..93cd939 100644 --- a/os_faults/api/service.py +++ b/os_faults/api/service.py @@ -13,14 +13,11 @@ import abc -import six - from os_faults.api import base_driver from os_faults.api.utils import public -@six.add_metaclass(abc.ABCMeta) -class Service(base_driver.BaseDriver): +class Service(base_driver.BaseDriver, metaclass=abc.ABCMeta): def __init__(self, service_name, config, node_cls, cloud_management, hosts=None): diff --git a/os_faults/cmd/cmd.py b/os_faults/cmd/cmd.py index 42a2c64..ec77f3e 100644 --- a/os_faults/cmd/cmd.py +++ b/os_faults/cmd/cmd.py @@ -31,6 +31,7 @@ def describe_actions(klazz): return ['%s - %s' % (m[0], m[1].__doc__.split('\n')[0]) for m in sorted(methods)] + SERVICE_ACTIONS = describe_actions(service_pkg.Service) NODE_ACTIONS = describe_actions(node_collection_pkg.NodeCollection) @@ -163,5 +164,6 @@ def main(): command = ' '.join(command) os_faults.human_api(destructor, command) + if __name__ == '__main__': main() diff --git a/os_faults/drivers/shared_schemas.py b/os_faults/drivers/shared_schemas.py index 88bdfb0..5b7dfdb 100644 --- a/os_faults/drivers/shared_schemas.py +++ b/os_faults/drivers/shared_schemas.py @@ -14,7 +14,7 @@ PORT_SCHEMA = { 'type': 'array', - 'items': [ + 'prefixItems': [ {'enum': ['tcp', 'udp']}, {'type': 'integer', 'minimum': 0, 'maximum': 65535}, {'enum': ['egress', 'ingress']} diff --git a/os_faults/tests/devstack/playbooks/post.yml b/os_faults/tests/devstack/playbooks/post.yml index 464bfd9..6041427 100644 --- a/os_faults/tests/devstack/playbooks/post.yml +++ b/os_faults/tests/devstack/playbooks/post.yml @@ -2,7 +2,7 @@ - hosts: all vars: - - test_results_path: "/opt/stack/os-faults/.tox/{{tox_envlist}}/log/pytest_results.html" + - test_results_path: "{{ zuul.project.src_dir }}/.tox/{{tox_envlist}}/log/pytest_results.html" tasks: - name: Check whether test results file exists stat: @@ -10,7 +10,7 @@ register: test_results - name: Copy job results - become: yes + become: true synchronize: src: "{{ test_results_path }}" dest: "{{ zuul.executor.log_root }}" diff --git a/os_faults/tests/devstack/playbooks/pre.yml b/os_faults/tests/devstack/playbooks/pre.yml index 3ad70e4..86faf69 100644 --- a/os_faults/tests/devstack/playbooks/pre.yml +++ b/os_faults/tests/devstack/playbooks/pre.yml @@ -15,7 +15,7 @@ - name: Copy Zuul repos into devstack working directory command: rsync -a {{ item.path }} /opt/stack with_items: '{{ found_repos.files }}' - become: yes + become: true - name: Set ownership of repos file: @@ -24,10 +24,11 @@ recurse: true owner: stack group: stack - become: yes + become: true - hosts: all roles: - bindep + - ensure-tox - orchestrate-devstack diff --git a/os_faults/tests/devstack/playbooks/run_on_devstack.yml b/os_faults/tests/devstack/playbooks/run_on_devstack.yml index e240abe..2430818 100644 --- a/os_faults/tests/devstack/playbooks/run_on_devstack.yml +++ b/os_faults/tests/devstack/playbooks/run_on_devstack.yml @@ -1,13 +1,17 @@ --- - hosts: all - vars: - - stack_home: "/opt/stack" - - os_faults_home: "/opt/stack/os-faults" tasks: - - name: Run tests - command: "tox -e {{tox_envlist}}" - args: - chdir: "{{ os_faults_home }}" - become: yes - become_user: stack + - name: Change the owner of os-faults ssh key + file: + path: /opt/stack/.ssh/os-faults-key + owner: zuul + group: zuul + become: true + + +- hosts: all + roles: + - tox + vars: + - tox_envlist: "devstack" diff --git a/os_faults/tests/unit/ansible/test_executor.py b/os_faults/tests/unit/ansible/test_executor.py index 01871ef..c6d49e8 100644 --- a/os_faults/tests/unit/ansible/test_executor.py +++ b/os_faults/tests/unit/ansible/test_executor.py @@ -11,8 +11,9 @@ # See the License for the specific language governing permissions and # limitations under the License. +from unittest import mock + import ddt -import mock from os_faults.ansible import executor from os_faults.api import node_collection @@ -197,7 +198,7 @@ class AnsibleRunnerTestCase(test.TestCase): err = self.assertRaises(executor.AnsibleExecutionException, ex.execute, my_hosts, my_tasks, my_statuses) - self.assertEqual(type(err), executor.AnsibleExecutionUnreachable) + self.assertIsInstance(err, executor.AnsibleExecutionUnreachable) @mock.patch('os_faults.ansible.executor.find_ansible') @mock.patch('os_faults.ansible.executor.AnsibleRunner.run_playbook') @@ -218,7 +219,7 @@ class AnsibleRunnerTestCase(test.TestCase): err = self.assertRaises(executor.AnsibleExecutionException, ex.execute, my_hosts, my_tasks, my_statuses) - self.assertEqual(type(err), executor.AnsibleExecutionException) + self.assertIsInstance(err, executor.AnsibleExecutionException) @mock.patch('os_faults.ansible.executor.find_ansible') @mock.patch('copy.deepcopy') diff --git a/os_faults/tests/unit/api/test_human_api.py b/os_faults/tests/unit/api/test_human_api.py index 25adde4..1d0f7eb 100644 --- a/os_faults/tests/unit/api/test_human_api.py +++ b/os_faults/tests/unit/api/test_human_api.py @@ -10,8 +10,9 @@ # License for the specific language governing permissions and limitations # under the License. +from unittest import mock + import ddt -import mock from os_faults.api import error from os_faults.api import human diff --git a/os_faults/tests/unit/api/test_node_collection.py b/os_faults/tests/unit/api/test_node_collection.py index 78fe1f3..e84ec7b 100644 --- a/os_faults/tests/unit/api/test_node_collection.py +++ b/os_faults/tests/unit/api/test_node_collection.py @@ -12,9 +12,7 @@ # limitations under the License. import copy - -import mock -import six +from unittest import mock from os_faults.api import cloud_management from os_faults.api import error @@ -81,7 +79,7 @@ class NodeCollectionTestCase(test.TestCase): collection._check_nodes_types, self.node_collection) def test_repr(self): - self.assertIsInstance(repr(self.node_collection), six.string_types) + self.assertIsInstance(repr(self.node_collection), str) def test_len(self): self.assertEqual(4, len(self.node_collection)) diff --git a/os_faults/tests/unit/api/test_power_management.py b/os_faults/tests/unit/api/test_power_management.py index ce11dec..50727a0 100644 --- a/os_faults/tests/unit/api/test_power_management.py +++ b/os_faults/tests/unit/api/test_power_management.py @@ -11,7 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import mock +from unittest import mock from os_faults.api import error from os_faults.api import node_collection @@ -44,46 +44,50 @@ class PowerManagerTestCase(test.TestCase): def test_poweroff(self): self.pm.poweroff(self.hosts) - self.dummy_driver1.poweroff.called_once_with(host=self.hosts[0]) - self.dummy_driver2.poweroff.called_once_with(host=self.hosts[1]) + self.dummy_driver1.poweroff.assert_called_once_with(host=self.hosts[0]) + self.dummy_driver2.poweroff.assert_called_once_with(host=self.hosts[1]) def test_poweron(self): self.pm.poweron(self.hosts) - self.dummy_driver1.poweron.called_once_with(host=self.hosts[0]) - self.dummy_driver2.poweron.called_once_with(host=self.hosts[1]) + self.dummy_driver1.poweron.assert_called_once_with(host=self.hosts[0]) + self.dummy_driver2.poweron.assert_called_once_with(host=self.hosts[1]) def test_reset(self): self.pm.reset(self.hosts) - self.dummy_driver1.reset.called_once_with(host=self.hosts[0]) - self.dummy_driver2.reset.called_once_with(host=self.hosts[1]) + self.dummy_driver1.reset.assert_called_once_with(host=self.hosts[0]) + self.dummy_driver2.reset.assert_called_once_with(host=self.hosts[1]) def test_shutdown(self): self.pm.shutdown(self.hosts) - self.dummy_driver1.shutdown.called_once_with(host=self.hosts[0]) - self.dummy_driver2.shutdown.called_once_with(host=self.hosts[1]) + self.dummy_driver1.shutdown.assert_called_once_with(host=self.hosts[0]) + self.dummy_driver2.shutdown.assert_called_once_with(host=self.hosts[1]) def test_snapshot(self): self.pm.snapshot(self.hosts, 'snap1', suspend=False) - self.dummy_driver1.snapshot.called_once_with(host=self.hosts[0], - snapshot_name='snap1', - suspend=False) - self.dummy_driver2.snapshot.called_once_with(host=self.hosts[1], - snapshot_name='snap1', - suspend=False) + self.dummy_driver1.snapshot.assert_called_once_with( + host=self.hosts[0], + snapshot_name='snap1', + suspend=False) + self.dummy_driver2.snapshot.assert_called_once_with( + host=self.hosts[1], + snapshot_name='snap1', + suspend=False) def test_revert(self): self.pm.revert(self.hosts, 'snap1', resume=False) - self.dummy_driver1.revert.called_once_with(host=self.hosts[0], - snapshot_name='snap1', - resume=False) - self.dummy_driver2.revert.called_once_with(host=self.hosts[1], - snapshot_name='snap1', - resume=False) + self.dummy_driver1.revert.assert_called_once_with( + host=self.hosts[0], + snapshot_name='snap1', + resume=False) + self.dummy_driver2.revert.assert_called_once_with( + host=self.hosts[1], + snapshot_name='snap1', + resume=False) def test_run_error(self): self.dummy_driver2.reset.side_effect = Exception() diff --git a/os_faults/tests/unit/cmd/test_cmd.py b/os_faults/tests/unit/cmd/test_cmd.py index 7c9a1bc..874276d 100644 --- a/os_faults/tests/unit/cmd/test_cmd.py +++ b/os_faults/tests/unit/cmd/test_cmd.py @@ -11,7 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import mock +from unittest import mock from os_faults.cmd import cmd from os_faults.tests.unit import test diff --git a/os_faults/tests/unit/cmd/test_main.py b/os_faults/tests/unit/cmd/test_main.py index 50bba4d..9137603 100644 --- a/os_faults/tests/unit/cmd/test_main.py +++ b/os_faults/tests/unit/cmd/test_main.py @@ -12,9 +12,9 @@ # limitations under the License. import os +from unittest import mock from click import testing -import mock from os_faults.api import cloud_management from os_faults.api import node_collection diff --git a/os_faults/tests/unit/drivers/cloud/test_devstack.py b/os_faults/tests/unit/drivers/cloud/test_devstack.py index 6aa0b92..cf7553e 100644 --- a/os_faults/tests/unit/drivers/cloud/test_devstack.py +++ b/os_faults/tests/unit/drivers/cloud/test_devstack.py @@ -11,9 +11,10 @@ # See the License for the specific language governing permissions and # limitations under the License. +from unittest import mock + import copy import ddt -import mock from os_faults.api import node_collection from os_faults.drivers.cloud import devstack diff --git a/os_faults/tests/unit/drivers/cloud/test_saltcloud.py b/os_faults/tests/unit/drivers/cloud/test_saltcloud.py index 92c93fa..e30d148 100644 --- a/os_faults/tests/unit/drivers/cloud/test_saltcloud.py +++ b/os_faults/tests/unit/drivers/cloud/test_saltcloud.py @@ -11,8 +11,9 @@ # See the License for the specific language governing permissions and # limitations under the License. +from unittest import mock + import ddt -import mock from os_faults.ansible import executor from os_faults.api import node_collection diff --git a/os_faults/tests/unit/drivers/cloud/test_universal.py b/os_faults/tests/unit/drivers/cloud/test_universal.py index 4704b7b..19fd159 100644 --- a/os_faults/tests/unit/drivers/cloud/test_universal.py +++ b/os_faults/tests/unit/drivers/cloud/test_universal.py @@ -11,8 +11,9 @@ # See the License for the specific language governing permissions and # limitations under the License. +from unittest import mock + import ddt -import mock from os_faults.api import error from os_faults.drivers.cloud import universal diff --git a/os_faults/tests/unit/drivers/power/test_ipmi.py b/os_faults/tests/unit/drivers/power/test_ipmi.py index 407a655..7d28fac 100644 --- a/os_faults/tests/unit/drivers/power/test_ipmi.py +++ b/os_faults/tests/unit/drivers/power/test_ipmi.py @@ -11,8 +11,9 @@ # See the License for the specific language governing permissions and # limitations under the License. +from unittest import mock + import ddt -import mock from pyghmi import exceptions as pyghmi_exc import os_faults diff --git a/os_faults/tests/unit/drivers/power/test_libvirt.py b/os_faults/tests/unit/drivers/power/test_libvirt.py index 09d05ed..040fae1 100644 --- a/os_faults/tests/unit/drivers/power/test_libvirt.py +++ b/os_faults/tests/unit/drivers/power/test_libvirt.py @@ -11,8 +11,9 @@ # See the License for the specific language governing permissions and # limitations under the License. +from unittest import mock + import ddt -import mock from os_faults.api import node_collection from os_faults.drivers.power import libvirt diff --git a/os_faults/tests/unit/drivers/services/test_process.py b/os_faults/tests/unit/drivers/services/test_process.py index 99f127e..3bb1a1e 100644 --- a/os_faults/tests/unit/drivers/services/test_process.py +++ b/os_faults/tests/unit/drivers/services/test_process.py @@ -12,8 +12,7 @@ # limitations under the License. import unittest - -import mock +from unittest import mock from os_faults.api.node_collection import Host from os_faults.api.node_collection import NodeCollection diff --git a/os_faults/tests/unit/test_os_faults.py b/os_faults/tests/unit/test_os_faults.py index bd4a61a..1fd4b1b 100644 --- a/os_faults/tests/unit/test_os_faults.py +++ b/os_faults/tests/unit/test_os_faults.py @@ -10,8 +10,9 @@ # License for the specific language governing permissions and limitations # under the License. +from unittest import mock + import jsonschema -import mock import os_faults from os_faults.ansible import executor diff --git a/os_faults/tests/unit/test_registry.py b/os_faults/tests/unit/test_registry.py index eaa5301..f4602de 100644 --- a/os_faults/tests/unit/test_registry.py +++ b/os_faults/tests/unit/test_registry.py @@ -12,8 +12,7 @@ import os import sys - -import mock +from unittest import mock from os_faults.api import base_driver from os_faults.api import error diff --git a/os_faults/tests/unit/test_utils.py b/os_faults/tests/unit/test_utils.py index 7e50a4c..b3f83d2 100644 --- a/os_faults/tests/unit/test_utils.py +++ b/os_faults/tests/unit/test_utils.py @@ -11,8 +11,7 @@ # under the License. import threading - -import mock +from unittest import mock from os_faults.tests.unit import test from os_faults import utils @@ -44,7 +43,7 @@ class UtilsTestCase(test.TestCase): tw.start_thread(target) tw.join_threads() - self.assertEqual(type(tw.errors[0]), MyException) + self.assertIsInstance(tw.errors[0], MyException) def test_join_threads(self): thread_1 = mock.Mock() diff --git a/requirements.txt b/requirements.txt index 08409f4..58ee4a2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,15 +8,9 @@ appdirs>=1.3.0 # MIT License click>=6.7 # BSD iso8601>=0.1.11 # MIT jsonschema>=2.6.0 # MIT -oslo.concurrency>=3.0.0,<4.0.0;python_version=='2.7' # Apache-2.0 -oslo.concurrency>=3.0.0;python_version>='3.6' # Apache-2.0 -oslo.i18n>=2.1.0,<4.0.0;python_version=='2.7' # Apache-2.0 -oslo.i18n>=2.1.0;python_version>='3.6' # Apache-2.0 -oslo.serialization>=1.10.0,<3.0.0;python_version=='2.7' # Apache-2.0 -oslo.serialization>=1.10.0;python_version>='3.6' # Apache-2.0 -oslo.utils>=3.20.0,<4.0.0;python_version=='2.7' # Apache-2.0 -oslo.utils>=3.20.0;python_version>='3.6' # Apache-2.0 -pyghmi>=1.0.9,<1.5.0;python_version=='2.7' # Apache-2.0 -pyghmi>=1.0.9;python_version>='3.6' +oslo.concurrency>=3.0.0 # Apache-2.0 +oslo.i18n>=2.1.0 # Apache-2.0 +oslo.serialization>=1.10.0 # Apache-2.0 +oslo.utils>=3.20.0 # Apache-2.0 +pyghmi>=1.0.9 PyYAML>=3.10.0 # MIT -six>=1.9.0 # MIT diff --git a/setup.cfg b/setup.cfg index 7b2fb87..222849e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,17 +1,18 @@ [metadata] name = os_faults summary = OpenStack fault-injection library -description-file = +description_file = README.rst -description-content-type = text/x-rst; charset=UTF-8 +description_content_type = text/x-rst; charset=UTF-8 author = OpenStack -author-email = openstack-discuss@lists.openstack.org +author_email = openstack-discuss@lists.openstack.org url = http://os-faults.readthedocs.io/ download_url = https://pypi.org/project/os-faults/ project_urls = Bug Tracker = https://bugs.launchpad.net/os-faults Documentation = http://os-faults.readthedocs.io/ Source Code = https://opendev.org/performa/os-faults/ +python_requires = >=3.8 classifier = Environment :: OpenStack Intended Audience :: Information Technology @@ -19,11 +20,11 @@ classifier = License :: OSI Approved :: Apache Software License Operating System :: POSIX :: Linux Programming Language :: Python - Programming Language :: Python :: 2 - Programming Language :: Python :: 2.7 Programming Language :: Python :: 3 - Programming Language :: Python :: 3.6 - Programming Language :: Python :: 3.7 + Programming Language :: Python :: 3.8 + Programming Language :: Python :: 3.9 + Programming Language :: Python :: 3.10 + Programming Language :: Python :: 3.11 [files] packages = @@ -34,14 +35,6 @@ console_scripts = os-inject-fault = os_faults.cmd.cmd:main os-faults = os_faults.cmd.main:main -[build_sphinx] -source-dir = doc/source -build-dir = doc/build -all_files = 1 - -[upload_sphinx] -upload-dir = doc/build/html - [compile_catalog] directory = os_faults/locale domain = os_faults @@ -55,8 +48,3 @@ input_file = os_faults/locale/os_faults.pot keywords = _ gettext ngettext l_ lazy_gettext mapping_file = babel.cfg output_file = os_faults/locale/os_faults.pot - -[build_releasenotes] -all_files = 1 -build-dir = releasenotes/build -source-dir = releasenotes/source diff --git a/test-requirements.txt b/test-requirements.txt index d74de55..9846f01 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,8 +1,4 @@ -# The order of packages is significant, because pip processes them in the order -# of appearance. Changing the order has an impact on the overall integration -# process, which may cause wedges in the gate later. - -hacking>=1.1.0,<1.2.0 # Apache-2.0 +hacking>=6.1.0,<6.2.0 # Apache-2.0 pytest # MIT pytest-cov # MIT pytest-html # Mozilla Public License 2.0 (MPL 2.0) @@ -12,16 +8,7 @@ coverage>=4.0 # Apache-2.0 ddt>=1.0.1 # MIT mock>=2.0 # BSD python-subunit>=0.0.18 # Apache-2.0/BSD -sphinx!=1.6.6,!=1.6.7,<2.0.0;python_version=='2.7' # BSD -sphinx!=1.6.6,!=1.6.7;python_version>='3.4' # BSD -sphinxcontrib-programoutput # BSD -sphinx_rtd_theme # MIT -oslotest>=1.10.0,<4.0.0;python_version=='2.7' # Apache-2.0 -oslotest>=1.10.0;python_version>='3.6' # Apache-2.0 +oslotest>=1.10.0 # Apache-2.0 testrepository>=0.0.18 # Apache-2.0/BSD testscenarios>=0.4 # Apache-2.0/BSD testtools>=1.4.0 # MIT - -# releasenotes -reno>=1.8.0,<3.0.0;python_version=='2.7' # Apache-2.0 -reno>=1.8.0;python_version>='3.6' # Apache-2.0 diff --git a/tox.ini b/tox.ini index e1673dd..2e70f5c 100644 --- a/tox.ini +++ b/tox.ini @@ -1,35 +1,38 @@ [tox] -minversion = 2.6 -envlist = pep8,py27,py36,cover -skipsdist = True +minversion = 3.18.0 +envlist = pep8,py3,cover +ignore_basepython_conflict = True [testenv] +basepython = python3 usedevelop = True deps = - -c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt} + -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} -r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt -install_command = pip install -U {opts} {packages} setenv = VIRTUAL_ENV={envdir} -whitelist_externals = +allowlist_externals = find rm commands = find . -type f -name "*.pyc" -delete py.test -vvvv --html={envlogdir}/pytest_results.html --self-contained-html --durations=10 "os_faults/tests/unit" {posargs} -passenv = http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY +passenv = + http_proxy + HTTP_PROXY + https_proxy + HTTPS_PROXY + no_proxy + NO_PROXY [testenv:pep8] -basepython = python3 commands = flake8 . doc/ext [testenv:venv] -basepython = python3 commands = {posargs} [testenv:cover] -basepython = python3 commands = py.test --cov-config .coveragerc --cov-report html --cov=os_faults "os_faults/tests/unit" coverage html -d {envlogdir} @@ -40,7 +43,6 @@ commands = # 1) create SSH key in os-faults folder: ssh-keygen -t rsa -f os_faults_key -N '' # 2) copy public key into authorized_keys of user stack: cat os_faults_key.pub >> ~/.ssh/authorized_keys # 3) run tests normally: tox -e devstack -basepython = python3 setenv = {[testenv]setenv} OS_TEST_PATH=./os_faults/tests/devstack OS_DEBUG=True @@ -50,13 +52,18 @@ commands = py.test -vvvv --html={envlogdir}/pytest_results.html --self-contained-html --durations=10 "os_faults/tests/devstack" {posargs} [testenv:docs] -basepython = python3 +allowlist_externals = + rm +deps = + -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} + -r{toxinidir}/doc/requirements.txt + -r{toxinidir}/requirements.txt commands = - rm -rf doc/build - python setup.py build_sphinx --warning-is-error + rm -rf doc/build + sphinx-build -W --keep-going -b html doc/source doc/build/html [testenv:releasenotes] -basepython = python3 +deps = {[testenv:docs]deps} commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html @@ -64,6 +71,8 @@ commands = # E123 skipped because it is ignored by default in the default pep8. # E125 skipped until https://github.com/jcrocholl/pep8/issues/126 is resolved. # E731 skipped as assign a lambda expression -ignore = E123,E125,E731 +# W503 line break before binary operator +# W504 line break after binary operator +ignore = E123,E125,E731,W503,W504 show-source = True exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build