From 497983742ebfccd7d59ab56a752bab8c79f2987c Mon Sep 17 00:00:00 2001 From: Carl George Date: Feb 05 2021 02:02:34 +0000 Subject: Fix FTBFS with PyYAML 5.4.1 https://bugzilla.redhat.com/show_bug.cgi?id=1917364 https://github.com/datadriventests/ddt/issues/95 --- diff --git a/0001-Use-Yaml-s-UnsafeLoader-for-Python-embedding-tests.patch b/0001-Use-Yaml-s-UnsafeLoader-for-Python-embedding-tests.patch new file mode 100644 index 0000000..1d07b82 --- /dev/null +++ b/0001-Use-Yaml-s-UnsafeLoader-for-Python-embedding-tests.patch @@ -0,0 +1,62 @@ +From 97f0a2315736e50f1b34a015447cd751da66ecb6 Mon Sep 17 00:00:00 2001 +From: Dirk Mueller +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 +--- + test/test_example.py | 2 +- + test/test_functional.py | 10 +++++----- + 2 files changed, 6 insertions(+), 6 deletions(-) + +diff --git a/test/test_example.py b/test/test_example.py +index db2cf17..1d27043 100644 +--- a/test/test_example.py ++++ b/test/test_example.py +@@ -151,7 +151,7 @@ if have_yaml_support: + + @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) +diff --git a/test/test_functional.py b/test/test_functional.py +index 45c1cae..f9609c6 100644 +--- a/test/test_functional.py ++++ b/test/test_functional.py +@@ -440,7 +440,7 @@ def test_load_yaml_with_python_tag(): + 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): +@@ -457,13 +457,13 @@ def test_load_yaml_with_python_tag(): + 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.') +-- +2.29.2 + diff --git a/python-ddt.spec b/python-ddt.spec index caefecc..807de43 100644 --- a/python-ddt.spec +++ b/python-ddt.spec @@ -17,11 +17,13 @@ combination with other testing frameworks like unittest and nose.} Name: python-%{pkgname} Version: 1.4.1 -Release: 4%{?dist} +Release: 5%{?dist} Summary: Python library to multiply test cases License: MIT URL: https://github.com/datadriventests/ddt Source0: %pypi_source +# https://github.com/datadriventests/ddt/pull/96 +Patch0: 0001-Use-Yaml-s-UnsafeLoader-for-Python-embedding-tests.patch BuildArch: noarch @@ -68,6 +70,9 @@ rm -rf %{eggname}.egg-info %changelog +* Fri Feb 05 2021 Carl George - 1.4.1-5 +- Fix FTBFS with PyYAML 5.4.1 rhbz#1917364 + * Wed Jan 27 2021 Fedora Release Engineering - 1.4.1-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild