]> git.ipfire.org Git - thirdparty/patchwork.git/commitdiff
Fix YAML loader warning
authorDaniel Axtens <dja@axtens.net>
Fri, 15 Mar 2019 06:27:40 +0000 (17:27 +1100)
committerStephen Finucane <stephen@that.guru>
Thu, 21 Mar 2019 13:20:30 +0000 (13:20 +0000)
In my tests I'm seeing:
/home/patchwork/patchwork/patchwork/tests/api/validator.py:229:
YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated,
as the default Loader is unsafe. Please read https://msg.pyyaml.org/load
for full details.

Fix this by using the safe loader in the tests.

Signed-off-by: Daniel Axtens <dja@axtens.net>
Reviewed-by: Stephen Finucane <stephen@that.guru>
patchwork/tests/api/validator.py

index 3f138479f88f033a2cc00fc341c85dee73f6b0ff..ad4d7f156cbe222149287d75d8aed966c46243da 100644 (file)
@@ -226,7 +226,7 @@ def _load_spec(version):
                              'patchwork.yaml')
 
     with open(spec_path, 'r') as fh:
-        data = yaml.load(fh)
+        data = yaml.load(fh, Loader=yaml.SafeLoader)
 
     _LOADED_SPECS[version] = openapi_core.create_spec(data)