modulemd-tools/0002-modulemd_tools-temporarily-skip-some-tests-on-EPEL8.patch
DistroBaker 98d6f4608f Merged update from upstream sources
This is an automated DistroBaker update from upstream sources.
If you do not know what this is about or would like to opt out,
contact the OSCI team.

Source: https://src.fedoraproject.org/rpms/modulemd-tools.git#3a92ffc0d368d0d4aee1649cfeb6aa593e171053
2021-01-22 14:57:01 +00:00

71 lines
2.6 KiB
Diff

From b6557cd10bdae6a839c56ef455020e82eb0e5988 Mon Sep 17 00:00:00 2001
From: Jakub Kadlcik <frostyx@email.cz>
Date: Wed, 13 Jan 2021 15:06:16 +0100
Subject: [PATCH 2/2] modulemd_tools: temporarily skip some tests on EPEL8
---
modulemd_tools/tests/test_yaml.py | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/modulemd_tools/tests/test_yaml.py b/modulemd_tools/tests/test_yaml.py
index ed5520cc86ded2e67994aa79ef8eeace9e7432ae..b079f65304cadb229fc475d8314f2c6233a7137a 100644
--- a/modulemd_tools/tests/test_yaml.py
+++ b/modulemd_tools/tests/test_yaml.py
@@ -1,13 +1,29 @@
import os
import unittest
from unittest import mock
from parameterized import parameterized
import yaml
+from distutils.version import LooseVersion
from modulemd_tools.yaml import (is_valid, validate, create, update, dump,
upgrade, _yaml2stream, _stream2yaml)
+import gi
+gi.require_version("Modulemd", "2.0")
+from gi.repository import Modulemd
+
+
+def old_libmodulemd():
+ """
+ Reading YAML string via `Modulemd.ModuleStream.read_string` and dumping it
+ again encapsulates its value in double-quotes, and it messes up with some of
+ our tests (since the older version does exactly the opposite). Let's just
+ skip those few test on EPEL8 until it receives an update.
+ See also `080e2bb`
+ """
+ return LooseVersion(Modulemd.get_version()) < LooseVersion("2.11.1")
+
class TestYaml(unittest.TestCase):
def test_is_valid(self):
self.assertTrue(is_valid(yaml1))
@@ -298,10 +314,11 @@ class TestYaml(unittest.TestCase):
self.assertEqual(mod_stream.get_mdversion(), 2)
self.assertEqual(mod_stream.get_module_name(), "")
self.assertEqual(mod_stream.get_summary(),
"A test module in all its beautiful beauty")
+ @unittest.skipIf(old_libmodulemd(), "Old modulemd drops stream value quotes")
def test_upgrade_to_same_version(self):
result = upgrade(yaml1, 2)
self.assertEqual(result, yaml1)
def test_upgrade_cannot_downgrade(self):
@@ -364,10 +381,11 @@ class TestYaml(unittest.TestCase):
with self.assertRaises(ValueError) as context:
_yaml2stream(yaml5_multiple_modules)
self.assertIn("YAML contained more than a single subdocument",
str(context.exception))
+ @unittest.skipIf(old_libmodulemd(), "Old modulemd drops stream value quotes")
def test_stream2yaml(self):
mod_stream = _yaml2stream(yaml1)
self.assertEqual(_stream2yaml(mod_stream), yaml1)
mod_stream.set_summary(None)
--
2.29.2