From 104cb896ea13485f44b7af8bb7ee00627c82071d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Van=C4=9Bk?= Date: Wed, 21 Jun 2023 17:01:20 +0200 Subject: [PATCH] Replace find_module function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit find_module function was deprecated in Python 3.4 [1] and later removed in Python 3.12 [2], the find_spec function should be used instead. This change is necessary for proper Python 3.12 support. [1] https://docs.python.org/3.4/library/importlib.html#importlib.abc.MetaPathFinder.find_module [2] https://github.com/python/cpython/issues/98040 Change-Id: I8354918d6548192dea3492eb2ee682d323559912 Signed-off-by: Petr Vaněk --- oslotest/modules.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oslotest/modules.py b/oslotest/modules.py index f453b17..8fe04a2 100644 --- a/oslotest/modules.py +++ b/oslotest/modules.py @@ -45,6 +45,6 @@ class _NoModuleFinder(object): def __init__(self, module): self.module = module - def find_module(self, fullname, path): + def find_spec(self, fullname, path, target): if fullname == self.module or fullname.startswith(self.module + '.'): raise ImportError