Blame SOURCES/0001-Use-Yaml-s-UnsafeLoader-for-Python-embedding-tests.patch

18d78d
From 97f0a2315736e50f1b34a015447cd751da66ecb6 Mon Sep 17 00:00:00 2001
18d78d
From: Dirk Mueller <dirk@dmllr.de>
18d78d
Date: Mon, 25 Jan 2021 22:49:04 +0100
18d78d
Subject: [PATCH] Use Yaml's UnsafeLoader for Python embedding tests
18d78d
18d78d
In newer PyYAML versions the default FullLoader has
18d78d
python/object/* integration removed. One has to use
18d78d
UnsafeLoader instead. see this issue for details:
18d78d
18d78d
https://github.com/yaml/pyyaml/issues/321
18d78d
---
18d78d
 test/test_example.py    |  2 +-
18d78d
 test/test_functional.py | 10 +++++-----
18d78d
 2 files changed, 6 insertions(+), 6 deletions(-)
18d78d
18d78d
diff --git a/test/test_example.py b/test/test_example.py
18d78d
index db2cf17..1d27043 100644
18d78d
--- a/test/test_example.py
18d78d
+++ b/test/test_example.py
18d78d
@@ -151,7 +151,7 @@ if have_yaml_support:
18d78d
 
18d78d
     @ddt
18d78d
     class YamlOnlyTestCase(unittest.TestCase):
18d78d
-        @file_data('data/test_custom_yaml_loader.yaml', yaml.FullLoader)
18d78d
+        @file_data('data/test_custom_yaml_loader.yaml', yaml.UnsafeLoader)
18d78d
         def test_custom_yaml_loader(self, instance, expected):
18d78d
             """Test with yaml tags to create specific classes to compare"""
18d78d
             self.assertEqual(expected, instance)
18d78d
diff --git a/test/test_functional.py b/test/test_functional.py
18d78d
index 45c1cae..f9609c6 100644
18d78d
--- a/test/test_functional.py
18d78d
+++ b/test/test_functional.py
18d78d
@@ -440,7 +440,7 @@ def test_load_yaml_with_python_tag():
18d78d
     loader allowing python tags is passed.
18d78d
     """
18d78d
 
18d78d
-    from yaml import FullLoader
18d78d
+    from yaml import UnsafeLoader
18d78d
     from yaml.constructor import ConstructorError
18d78d
 
18d78d
     def str_to_type(class_name):
18d78d
@@ -457,13 +457,13 @@ def test_load_yaml_with_python_tag():
18d78d
             raise AssertionError()
18d78d
 
18d78d
     @ddt
18d78d
-    class YamlFullLoaderTest(object):
18d78d
-        @file_data('data/test_functional_custom_tags.yaml', FullLoader)
18d78d
+    class YamlUnsafeLoaderTest(object):
18d78d
+        @file_data('data/test_functional_custom_tags.yaml', UnsafeLoader)
18d78d
         def test_cls_is_instance(self, instance, expected):
18d78d
             assert isinstance(instance, str_to_type(expected))
18d78d
 
18d78d
-    tests = list(filter(_is_test, YamlFullLoaderTest.__dict__))
18d78d
-    obj = YamlFullLoaderTest()
18d78d
+    tests = list(filter(_is_test, YamlUnsafeLoaderTest.__dict__))
18d78d
+    obj = YamlUnsafeLoaderTest()
18d78d
 
18d78d
     if not tests:
18d78d
         raise AssertionError('No tests have been found.')
18d78d
-- 
18d78d
2.29.2
18d78d