5f720e
From 497810f8adb992bfecf04e8eacf4ac1340ee6fe0 Mon Sep 17 00:00:00 2001
5f720e
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
5f720e
Date: Tue, 20 Aug 2019 08:50:58 +0200
5f720e
Subject: [PATCH] tests: skip unrar test gracefully if module is missing
5f720e
5f720e
Fedora (and probably some other distributions) cannot include unrardll
5f720e
because of licensing reasons. Unfortuantely this situation is unlikely
5f720e
to change in the near future. Skip the test if the module is not
5f720e
available.
5f720e
---
5f720e
 src/calibre/test_build.py | 5 +++++
5f720e
 1 file changed, 5 insertions(+)
5f720e
5f720e
diff --git a/src/calibre/test_build.py b/src/calibre/test_build.py
5f720e
index c17a5ef785..7514d05046 100644
5f720e
--- a/src/calibre/test_build.py
5f720e
+++ b/src/calibre/test_build.py
5f720e
@@ -17,6 +17,10 @@
5f720e
 
5f720e
 is_ci = os.environ.get('CI', '').lower() == 'true'
5f720e
 
5f720e
+try:
5f720e
+    import unrardll
5f720e
+except ModuleNotFoundError:
5f720e
+    unrardll = None
5f720e
 
5f720e
 class BuildTest(unittest.TestCase):
5f720e
 
5f720e
@@ -236,6 +240,7 @@ def test_file_dialog_helper(self):
5f720e
         from calibre.gui2.win_file_dialogs import test
5f720e
         test()
5f720e
 
5f720e
+    @unittest.skipUnless(unrardll, 'Module unrardll is missing')
5f720e
     def test_unrar(self):
5f720e
         from calibre.utils.unrar import test_basic
5f720e
         test_basic()