Drop usage of pkg_resources
The pkg_resources module was deprecated. It was removed from the core Python and has been moved to setuptools in Python 3.12. Replace usage of pkg_resources.declare_namespace by implicit namespace package[1][2] which has been supported since Python 3.3. [1] https://peps.python.org/pep-0420/ [2] https://packaging.python.org/en/latest/guides/packaging-namespace-packages/ Closes-Bug: #2083620 Change-Id: If1a9d7048412b60bfa997028fb3df5773e66693c
This commit is contained in:
parent
37076155e6
commit
14b5232e12
nova
@ -19,7 +19,9 @@
|
||||
Test WSGI basics and provide some helper functions for other WSGI tests.
|
||||
"""
|
||||
|
||||
import collections
|
||||
import tempfile
|
||||
from unittest import mock
|
||||
|
||||
import routes
|
||||
import webob
|
||||
@ -29,6 +31,11 @@ import nova.exception
|
||||
from nova import test
|
||||
|
||||
|
||||
os_uname = collections.namedtuple(
|
||||
'uname_result', ['sysname', 'nodename', 'release', 'version', 'machine'],
|
||||
)
|
||||
|
||||
|
||||
class TestRouter(test.NoDBTestCase):
|
||||
|
||||
def test_router(self):
|
||||
@ -104,7 +111,10 @@ document_root = /tmp
|
||||
)
|
||||
|
||||
def test_app_found(self):
|
||||
url_parser = self.loader.load_app("test_app")
|
||||
with mock.patch('os.uname') as mock_uname:
|
||||
mock_uname.return_value = os_uname(
|
||||
'Linux', '', '5.10.13-200-generic', '', 'x86_64')
|
||||
url_parser = self.loader.load_app("test_app")
|
||||
self.assertEqual("/tmp", url_parser.directory)
|
||||
|
||||
def tearDown(self):
|
||||
|
@ -1,18 +0,0 @@
|
||||
# Copyright 2016 IBM Corp.
|
||||
#
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
# Allow composition of nova.virt namespace from disparate packages.
|
||||
__import__('pkg_resources').declare_namespace(__name__)
|
Loading…
x
Reference in New Issue
Block a user