From 4fd41a7033dedca07ec247d19b1ca4ef743fb48b Mon Sep 17 00:00:00 2001 From: Clark Boylan Date: Mon, 29 Apr 2024 11:39:40 -0700 Subject: [PATCH] Update afsmon python testing to modern versions We run this tool primarily on our mirror-update nodes which are currently Focal with python3.8. We want to drop the python35 testing so that we can clean up our Xenial test nodes. Update afsmon's testing to more closely match the current production environment and potential future environments while also dropping python35 on Xenial jobs. Small changes are made to fix a string escapes warning and a use of mock error when running flake8. Change-Id: Id509936bf9eb200fc92dcaa06a18c1a79ef13e2c --- .zuul.yaml | 18 ++++++++++++++---- afsmon/__init__.py | 2 +- afsmon/tests/test_afsmon.py | 4 ++-- setup.cfg | 10 +++++----- 4 files changed, 22 insertions(+), 12 deletions(-) diff --git a/.zuul.yaml b/.zuul.yaml index d0b194d..a52e9f4 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -1,9 +1,19 @@ - project: - templates: - - openstack-python35-jobs check: jobs: - - openstack-tox-pep8 + - tox-pep8 + - tox-py38: + nodeset: ubuntu-focal + - tox-py310: + nodeset: ubuntu-jammy + - tox-py311: + nodeset: debian-bookworm gate: jobs: - - openstack-tox-pep8 \ No newline at end of file + - tox-pep8 + - tox-py38: + nodeset: ubuntu-focal + - tox-py310: + nodeset: ubuntu-jammy + - tox-py311: + nodeset: debian-bookworm diff --git a/afsmon/__init__.py b/afsmon/__init__.py index d70938f..c7bf789 100644 --- a/afsmon/__init__.py +++ b/afsmon/__init__.py @@ -81,7 +81,7 @@ class FileServerStats(object): # Matching: # mirror.yum-puppetlabs.readonly 536871036 RO 63026403 K On-line vol_regex = re.compile( - '^(?P[^\s]+)\s+(?P\d+)\s(?PR[OW]|BK)\s+(?P\d+) K' # noqa: E501 + r'^(?P[^\s]+)\s+(?P\d+)\s(?PR[OW]|BK)\s+(?P\d+) K' # noqa: E501 ) # Read the output into chunks where each chunk is the info for diff --git a/afsmon/tests/test_afsmon.py b/afsmon/tests/test_afsmon.py index 00f6d17..515f24f 100644 --- a/afsmon/tests/test_afsmon.py +++ b/afsmon/tests/test_afsmon.py @@ -11,8 +11,8 @@ # under the License. import afsmon import configparser -import mock import os +import unittest.mock from afsmon.cmd.main import AFSMonCmd from afsmon.tests import base @@ -77,7 +77,7 @@ class TestPyAFSMon(base.TestCase): 'afs.afs01_dfw_openstack_org.vol.mirror_foo.creation', value=str(d.strftime("%s")), kind='g') - @mock.patch('afsmon.subprocess.check_output', autospec=True) + @unittest.mock.patch('afsmon.subprocess.check_output', autospec=True) def test_vos_listvol_parsing(self, mock_check_output): with open(os.path.join( diff --git a/setup.cfg b/setup.cfg index 13f0831..5995619 100644 --- a/setup.cfg +++ b/setup.cfg @@ -5,17 +5,17 @@ description-file = README.rst author = Ian Wienand author-email = ian@wienand.org -home-page = https://github.com/ianw/pyafsmon +home-page = https://opendev.org/opendev/afsmon classifier = Intended Audience :: Information Technology Intended Audience :: System Administrators License :: OSI Approved :: Apache Software License Operating System :: POSIX :: Linux Programming Language :: Python :: 3 - Programming Language :: Python :: 3.3 - Programming Language :: Python :: 3.4 - Programming Language :: Python :: 3.5 - Programming Language :: Python :: 3.6 + Programming Language :: Python :: 3.8 + Programming Language :: Python :: 3.9 + Programming Language :: Python :: 3.10 + Programming Language :: Python :: 3.11 [files] packages =