summary refs log tree commit diff
path: root/tests/test_preview.py
diff options
context:
space:
mode:
authorRichard van der Hoff <1389908+richvdh@users.noreply.github.com>2021-01-07 11:41:28 +0000
committerGitHub <noreply@github.com>2021-01-07 11:41:28 +0000
commit8d3d264052adffaf9ef36a6d9235aeeb8bef5fb5 (patch)
tree3383923f7df6ea3f5cce37eca113258350309379 /tests/test_preview.py
parentHandle updating schema version without any deltas. (#9033) (diff)
downloadsynapse-8d3d264052adffaf9ef36a6d9235aeeb8bef5fb5.tar.xz
Skip unit tests which require optional dependencies (#9031)
If we are lacking an optional dependency, skip the tests that rely on it.
Diffstat (limited to 'tests/test_preview.py')
-rw-r--r--tests/test_preview.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/test_preview.py b/tests/test_preview.py
index a883d707df..c19facc1cb 100644
--- a/tests/test_preview.py
+++ b/tests/test_preview.py
@@ -20,8 +20,16 @@ from synapse.rest.media.v1.preview_url_resource import (
 
 from . import unittest
 
+try:
+    import lxml
+except ImportError:
+    lxml = None
+
 
 class PreviewTestCase(unittest.TestCase):
+    if not lxml:
+        skip = "url preview feature requires lxml"
+
     def test_long_summarize(self):
         example_paras = [
             """Tromsø (Norwegian pronunciation: [ˈtrʊmsœ] ( listen); Northern Sami:
@@ -137,6 +145,9 @@ class PreviewTestCase(unittest.TestCase):
 
 
 class PreviewUrlTestCase(unittest.TestCase):
+    if not lxml:
+        skip = "url preview feature requires lxml"
+
     def test_simple(self):
         html = """
         <html>