Blob Blame Raw
From 497810f8adb992bfecf04e8eacf4ac1340ee6fe0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Tue, 20 Aug 2019 08:50:58 +0200
Subject: [PATCH] tests: skip unrar test gracefully if module is missing

Fedora (and probably some other distributions) cannot include unrardll
because of licensing reasons. Unfortuantely this situation is unlikely
to change in the near future. Skip the test if the module is not
available.
---
 src/calibre/test_build.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/calibre/test_build.py b/src/calibre/test_build.py
index c17a5ef785..7514d05046 100644
--- a/src/calibre/test_build.py
+++ b/src/calibre/test_build.py
@@ -17,6 +17,10 @@
 
 is_ci = os.environ.get('CI', '').lower() == 'true'
 
+try:
+    import unrardll
+except ModuleNotFoundError:
+    unrardll = None
 
 class BuildTest(unittest.TestCase):
 
@@ -236,6 +240,7 @@ def test_file_dialog_helper(self):
         from calibre.gui2.win_file_dialogs import test
         test()
 
+    @unittest.skipUnless(unrardll, 'Module unrardll is missing')
     def test_unrar(self):
         from calibre.utils.unrar import test_basic
         test_basic()