Merge "Replace pkg_resources"
This commit is contained in:
@@ -14,11 +14,10 @@
|
|||||||
|
|
||||||
import collections
|
import collections
|
||||||
import copy
|
import copy
|
||||||
import os.path
|
import importlib.resources
|
||||||
|
|
||||||
from oslo_serialization import jsonutils
|
from oslo_serialization import jsonutils
|
||||||
|
|
||||||
import pkg_resources as pkg
|
|
||||||
from urllib import parse
|
from urllib import parse
|
||||||
from urllib import request
|
from urllib import request
|
||||||
|
|
||||||
@@ -61,11 +60,9 @@ class TestEnvironmentsV2(base.BaseClientV2Test):
|
|||||||
|
|
||||||
def test_create_with_json_file_uri(self):
|
def test_create_with_json_file_uri(self):
|
||||||
# The contents of env_v2.json must be equivalent to ENVIRONMENT
|
# The contents of env_v2.json must be equivalent to ENVIRONMENT
|
||||||
path = pkg.resource_filename(
|
path = str(importlib.resources.files('mistralclient').joinpath(
|
||||||
'mistralclient',
|
|
||||||
'tests/unit/resources/env_v2.json'
|
'tests/unit/resources/env_v2.json'
|
||||||
)
|
))
|
||||||
path = os.path.abspath(path)
|
|
||||||
|
|
||||||
# Convert the file path to file URI
|
# Convert the file path to file URI
|
||||||
uri = parse.urljoin('file:', request.pathname2url(path))
|
uri = parse.urljoin('file:', request.pathname2url(path))
|
||||||
@@ -115,10 +112,9 @@ class TestEnvironmentsV2(base.BaseClientV2Test):
|
|||||||
|
|
||||||
def test_update_with_yaml_file(self):
|
def test_update_with_yaml_file(self):
|
||||||
# The contents of env_v2.json must be equivalent to ENVIRONMENT
|
# The contents of env_v2.json must be equivalent to ENVIRONMENT
|
||||||
path = pkg.resource_filename(
|
path = str(importlib.resources.files('mistralclient').joinpath(
|
||||||
'mistralclient',
|
|
||||||
'tests/unit/resources/env_v2.json'
|
'tests/unit/resources/env_v2.json'
|
||||||
)
|
))
|
||||||
data = collections.OrderedDict(
|
data = collections.OrderedDict(
|
||||||
utils.load_content(
|
utils.load_content(
|
||||||
utils.get_contents_if_file(path)
|
utils.get_contents_if_file(path)
|
||||||
|
Reference in New Issue
Block a user