libmodulemd/0001-Skip-python-tests-where-unsupported.patch
Stephen Gallagher c16a3ce861
Patch EPEL to skip the python tests
Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
2018-03-14 14:57:12 -04:00

45 lines
1.3 KiB
Diff

From c118049a734891287c04163617fb4fb994c18a7b Mon Sep 17 00:00:00 2001
From: Stephen Gallagher <sgallagh@redhat.com>
Date: Wed, 14 Mar 2018 14:46:20 -0400
Subject: [PATCH] Skip python tests where unsupported
Some platforms like RHEL 7 do not have python3-gobject
Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
---
modulemd/test-modulemd-python.py | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/modulemd/test-modulemd-python.py b/modulemd/test-modulemd-python.py
index ae292ecb7b6a5c6778a0f25db58b55d5172d3e03..83e62055c461f7269482dd2d408a1c7979732879 100755
--- a/modulemd/test-modulemd-python.py
+++ b/modulemd/test-modulemd-python.py
@@ -1,14 +1,20 @@
#!/usr/bin/python3
import os
-import unittest
+import sys
-import gi
-gi.require_version('Modulemd', os.getenv('MODULEMD_NSVERSION'))
-from gi.repository import Modulemd
-from gi.repository import GLib
+try:
+ import unittest
+ import gi
+ gi.require_version('Modulemd', os.getenv('MODULEMD_NSVERSION'))
+ from gi.repository import Modulemd
+ from gi.repository import GLib
+except ImportError:
+ # Return error 77 to skip this test on platforms without the necessary
+ # python modules
+ sys.exit (77)
class TestIssues(unittest.TestCase):
def test_issue24(self):
# Verify that we can handle boolean variant types
--
2.14.3