Get rid of pkg_resources

... because it was removed in Python 3.12 [1].

[1] https://docs.python.org/3/whatsnew/3.12.html#ensurepip

Change-Id: I7b1d39e1d597e39ce1186b8775d49315373db134
This commit is contained in:
Takashi Kajinami 2024-10-03 00:17:06 +09:00
parent 926301e46b
commit cbae96f923
4 changed files with 20 additions and 41 deletions

View File

@ -14,7 +14,6 @@
# limitations under the License.
import os.path
import pkg_resources as pkg
from urllib import parse
from urllib import request
@ -96,10 +95,8 @@ class TestActionsV2(base.BaseClientV2Test):
status_code=201)
# The contents of action_v2.yaml must be identical to ACTION_DEF
path = pkg.resource_filename(
'mistralclient',
'tests/unit/resources/action_v2.yaml'
)
path = os.path.join(os.path.dirname(os.path.abspath(__file__)),
'..', 'resources', 'action_v2.yaml')
actions = self.actions.create(path)
@ -160,10 +157,8 @@ class TestActionsV2(base.BaseClientV2Test):
json={'actions': [ACTION]})
# The contents of action_v2.yaml must be identical to ACTION_DEF
path = pkg.resource_filename(
'mistralclient',
'tests/unit/resources/action_v2.yaml'
)
path = os.path.join(os.path.dirname(os.path.abspath(__file__)),
'..', 'resources', 'action_v2.yaml')
path = os.path.abspath(path)
# Convert the file path to file URI
@ -286,10 +281,8 @@ class TestActionsV2(base.BaseClientV2Test):
json={'valid': True})
# The contents of action_v2.yaml must be identical to ACTION_DEF
path = pkg.resource_filename(
'mistralclient',
'tests/unit/resources/action_v2.yaml'
)
path = os.path.join(os.path.dirname(os.path.abspath(__file__)),
'..', 'resources', 'action_v2.yaml')
result = self.actions.validate(path)

View File

@ -16,7 +16,7 @@
# under the License.
#
import pkg_resources as pkg
import os.path
from unittest import mock
from oslo_serialization import jsonutils
@ -116,10 +116,8 @@ class TestCLIExecutionsV2(base.BaseCommandTest):
def test_create_wf_input_file(self):
self.client.executions.create.return_value = EXEC
path = pkg.resource_filename(
'mistralclient',
'tests/unit/resources/ctx.json'
)
path = os.path.join(os.path.dirname(os.path.abspath(__file__)),
'..', 'resources', 'ctx.json')
result = self.call(
execution_cmd.Create,

View File

@ -14,7 +14,6 @@
# limitations under the License.
import os.path
import pkg_resources as pkg
from urllib import parse
from urllib import request
@ -95,11 +94,8 @@ class TestWorkbooksV2(base.BaseClientV2Test):
)
# The contents of wb_v2.yaml must be identical to WB_DEF
path = pkg.resource_filename(
'mistralclient',
'tests/unit/resources/wb_v2.yaml'
)
path = os.path.abspath(path)
path = os.path.join(os.path.dirname(os.path.abspath(__file__)),
'..', 'resources', 'wb_v2.yaml')
# Convert the file path to file URI
uri = parse.urljoin('file:', request.pathname2url(path))
@ -131,10 +127,8 @@ class TestWorkbooksV2(base.BaseClientV2Test):
self.requests_mock.put(self.TEST_URL + URL_TEMPLATE, json=WORKBOOK)
# The contents of wb_v2.yaml must be identical to WB_DEF
path = pkg.resource_filename(
'mistralclient',
'tests/unit/resources/wb_v2.yaml'
)
path = os.path.join(os.path.dirname(os.path.abspath(__file__)),
'..', 'resources', 'wb_v2.yaml')
wb = self.workbooks.update(path)
@ -207,10 +201,8 @@ class TestWorkbooksV2(base.BaseClientV2Test):
)
# The contents of wb_v2.yaml must be identical to WB_DEF
path = pkg.resource_filename(
'mistralclient',
'tests/unit/resources/wb_v2.yaml'
)
path = os.path.join(os.path.dirname(os.path.abspath(__file__)),
'..', 'resources', 'wb_v2.yaml')
result = self.workbooks.validate(path)

View File

@ -13,7 +13,6 @@
# limitations under the License.
import os.path
import pkg_resources as pkg
from urllib import parse
from urllib import request
@ -71,10 +70,8 @@ class TestWorkflowsV2(base.BaseClientV2Test):
)
# The contents of wf_v2.yaml must be identical to WF_DEF
path = pkg.resource_filename(
'mistralclient',
'tests/unit/resources/wf_v2.yaml'
)
path = os.path.join(os.path.dirname(os.path.abspath(__file__)),
'..', 'resources', 'wf_v2.yaml')
wfs = self.workflows.create(path)
@ -126,10 +123,9 @@ class TestWorkflowsV2(base.BaseClientV2Test):
)
# The contents of wf_v2.yaml must be identical to WF_DEF
path = pkg.resource_filename(
'mistralclient',
'tests/unit/resources/wf_v2.yaml'
)
path = os.path.join(os.path.dirname(os.path.abspath(__file__)),
'..', 'resources', 'wf_v2.yaml')
path = os.path.abspath(path)
# Convert the file path to file URI