From 002ad59c9ee1d55f90f73b2bbfc027905dcddb0b Mon Sep 17 00:00:00 2001 From: Pete Zaitcev Date: Wed, 11 Oct 2023 12:04:42 -0500 Subject: [PATCH] tests: drop pkg_resources from test_auditor.py We need to get rid of pkg_resources for py312. Fortunately, we already use the load_pkg_resources() wrapper everywhere. And, the tests of watchers already mock it. So, the general mocking of pkg_resources was not doing anything, and this patch simply deletes it. Change-Id: Ifbdbbe18d6df6df377f0d914a097328d9c9e95ee --- swift/obj/watchers/dark_data.py | 2 +- test/unit/obj/test_auditor.py | 9 --------- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/swift/obj/watchers/dark_data.py b/swift/obj/watchers/dark_data.py index 01b3dc8071..0fb3116192 100644 --- a/swift/obj/watchers/dark_data.py +++ b/swift/obj/watchers/dark_data.py @@ -16,7 +16,7 @@ # # This is an audit watcher that manages the dark data in the cluster. # Since the API for audit watchers is intended to use external plugins, -# this code is invoked as if it were external: through pkg_resources. +# this code is invoked as if it were external: through load_pkg_resources(). # Our setup.py comes pre-configured for convenience, but the operator has # to enable this watcher honestly by additing DarkDataWatcher to watchers= # in object-server.conf. The default is off, as if this does not exist. diff --git a/test/unit/obj/test_auditor.py b/test/unit/obj/test_auditor.py index 0c20c65482..f26764e058 100644 --- a/test/unit/obj/test_auditor.py +++ b/test/unit/obj/test_auditor.py @@ -17,7 +17,6 @@ import unittest import json import mock import os -import pkg_resources import signal import string import sys @@ -67,13 +66,6 @@ def works_only_once(callable_thing, exception): return only_once -def no_audit_watchers(group, name=None): - if group == 'swift.object_audit_watcher': - return iter([]) - else: - return pkg_resources.iter_entry_points(group, name) - - class FakeRing1(object): def __init__(self, swift_dir, ring_name=None): @@ -1595,7 +1587,6 @@ class TestAuditor(TestAuditorBase): .format(outstanding_pids)) -@mock.patch('pkg_resources.iter_entry_points', no_audit_watchers) @patch_policies(_mocked_policies) class TestAuditWatchers(TestAuditorBase):