Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pyyaml v6 Compatibility #33

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion swagger_bundler/loading.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def load(fp, format=None, fn_map={Format.yaml: yaml.load, Format.json: _json_loa
else:
fname = getattr(fp, "name", "(unknown)")
loader = dispatch_by_format(fname, fn_map, default=loading_config.input_format)
return loader(fp)
return loader(fp, Loader=yaml.SafeLoader)


def dump(d, fp, format=None, fn_map={Format.yaml: _yaml_dump, Format.json: _json_dump, Format.unknown: _yaml_dump}):
Expand Down
10 changes: 5 additions & 5 deletions swagger_bundler/tests/test_it.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def test_it(self):
subcontext = ctx.make_subcontext_from_port(rf)
result = self._callFUT(subcontext, subcontext.data)
with open(os.path.join(here, "data/xproduct.yaml")) as rf:
expected = yaml.load(rf)
expected = yaml.load(rf, yaml.SafeLoader)
self.assertEqual(result, expected)

def test_it__duplicated_import(self):
Expand All @@ -42,7 +42,7 @@ def test_it__duplicated_import(self):
subcontext = ctx.make_subcontext_from_port(rf)
result = self._callFUT(subcontext, subcontext.data)
with open(os.path.join(here, "data/yuser.yaml")) as rf:
expected = yaml.load(rf)
expected = yaml.load(rf, yaml.SafeLoader)
self.assertEqual(result, expected)

def test_it__exposed(self):
Expand All @@ -54,7 +54,7 @@ def test_it__exposed(self):
subcontext = ctx.make_subcontext_from_port(rf)
result = self._callFUT(subcontext, subcontext.data)
with open(os.path.join(here, "data/zgroup.yaml")) as rf:
expected = yaml.load(rf)
expected = yaml.load(rf, yaml.SafeLoader)
self.assertEqual(result, expected)

def test_it__recursive_information(self):
Expand All @@ -66,7 +66,7 @@ def test_it__recursive_information(self):
subcontext = ctx.make_subcontext_from_port(rf)
result = self._callFUT(subcontext, subcontext.data)
with open(os.path.join(here, "data/gugroup-user.yaml")) as rf:
expected = yaml.load(rf)
expected = yaml.load(rf, yaml.SafeLoader)
self.assertEqual(result, expected)

def test_it__qualified_Import(self):
Expand All @@ -78,5 +78,5 @@ def test_it__qualified_Import(self):
subcontext = ctx.make_subcontext_from_port(rf)
result = self._callFUT(subcontext, subcontext.data)
with open(os.path.join(here, "data/ouse-state.yaml")) as rf:
expected = yaml.load(rf)
expected = yaml.load(rf, yaml.SafeLoader)
self.assertEqual(result, expected)