1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
|
From 97f0a2315736e50f1b34a015447cd751da66ecb6 Mon Sep 17 00:00:00 2001
From: Dirk Mueller <dirk@dmllr.de>
Date: Mon, 25 Jan 2021 22:49:04 +0100
Subject: [PATCH] Use Yaml's UnsafeLoader for Python embedding tests
In newer PyYAML versions the default FullLoader has
python/object/* integration removed. One has to use
UnsafeLoader instead. see this issue for details:
https://github.com/yaml/pyyaml/issues/321
Bug-Debian: https://bugs.debian.org/989009
---
test/test_example.py | 2 +-
test/test_functional.py | 10 +++++-----
2 files changed, 6 insertions(+), 6 deletions(-)
--- a/test/test_example.py
+++ b/test/test_example.py
@@ -151,7 +151,7 @@
@ddt
class YamlOnlyTestCase(unittest.TestCase):
- @file_data('data/test_custom_yaml_loader.yaml', yaml.FullLoader)
+ @file_data('data/test_custom_yaml_loader.yaml', yaml.UnsafeLoader)
def test_custom_yaml_loader(self, instance, expected):
"""Test with yaml tags to create specific classes to compare"""
self.assertEqual(expected, instance)
--- a/test/test_functional.py
+++ b/test/test_functional.py
@@ -427,7 +427,7 @@
loader allowing python tags is passed.
"""
- from yaml import FullLoader
+ from yaml import UnsafeLoader
from yaml.constructor import ConstructorError
def str_to_type(class_name):
@@ -444,13 +444,13 @@
raise AssertionError()
@ddt
- class YamlFullLoaderTest(object):
- @file_data('data/test_functional_custom_tags.yaml', FullLoader)
+ class YamlUnsafeLoaderTest(object):
+ @file_data('data/test_functional_custom_tags.yaml', UnsafeLoader)
def test_cls_is_instance(self, instance, expected):
assert isinstance(instance, str_to_type(expected))
- tests = list(filter(_is_test, YamlFullLoaderTest.__dict__))
- obj = YamlFullLoaderTest()
+ tests = list(filter(_is_test, YamlUnsafeLoaderTest.__dict__))
+ obj = YamlUnsafeLoaderTest()
if not tests:
raise AssertionError('No tests have been found.')
|