Python 3.12: use importlib instead of imp

As per: https://docs.python.org/3/whatsnew/3.12.html
the imp module is gone. importlib has the same reload() function,
let's use it instead.

Change-Id: If3aa7d47fefd6a0fe416454d22cecd8dbed767f8
This commit is contained in:
Thomas Goirand 2023-12-12 14:34:38 +01:00
parent 546a8bef21
commit 7f4f0993c5
2 changed files with 4 additions and 4 deletions

View File

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import imp
import importlib
from unittest import mock
from oslo_concurrency import processutils
@ -24,7 +24,7 @@ from ovn_bgp_agent.tests import base as test_base
# Mock the privsep decorator and reload the module
mock.patch('ovn_bgp_agent.privileged.ovs_vsctl_cmd.entrypoint',
lambda x: x).start()
imp.reload(ovs_vsctl)
importlib.reload(ovs_vsctl)
class FakeException(Exception):

View File

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import imp
import importlib
from unittest import mock
from oslo_concurrency import processutils
@ -25,7 +25,7 @@ from ovn_bgp_agent.tests import base as test_base
# Mock the privsep decorator and reload the module
mock.patch('ovn_bgp_agent.privileged.vtysh_cmd.entrypoint',
lambda x: x).start()
imp.reload(vtysh)
importlib.reload(vtysh)
class FakeException(Exception):