|
2 | 2 | import unittest |
3 | 3 | from typing import ClassVar |
4 | 4 |
|
5 | | -try: |
6 | | - from kazoo.exceptions import KazooException |
7 | | -except ImportError as exc: |
8 | | - raise unittest.SkipTest("kazoo is not installed; skipping SolrCloud tests") from exc |
9 | | - |
10 | | - |
11 | 5 | from pysolr import SolrCloud, SolrError, ZooKeeper, json |
12 | 6 |
|
13 | 7 | from .test_client import SolrTestCase |
14 | 8 |
|
| 9 | +try: |
| 10 | + from kazoo.exceptions import KazooException |
| 11 | +except ImportError: |
| 12 | + KazooException = None |
| 13 | + |
15 | 14 |
|
16 | 15 | class ProxyZooKeeper(ZooKeeper): |
17 | 16 | """ |
@@ -59,6 +58,9 @@ def getHosts(self, collname, only_leader=False, seen_aliases=None): |
59 | 58 | return mapped |
60 | 59 |
|
61 | 60 |
|
| 61 | +@unittest.skipIf( |
| 62 | + KazooException is None, "kazoo is not installed; skipping SolrCloud tests" |
| 63 | +) |
62 | 64 | class SolrCloudTestCase(SolrTestCase): |
63 | 65 | @classmethod |
64 | 66 | def setUpClass(cls): |
@@ -92,10 +94,10 @@ def test_custom_results_class(self): |
92 | 94 | self.assertIn("response", results) |
93 | 95 |
|
94 | 96 | def test__send_request_to_bad_path(self): |
95 | | - unittest.SkipTest("This test makes no sense in a SolrCloud world") |
| 97 | + raise unittest.SkipTest("This test makes no sense in a SolrCloud world") |
96 | 98 |
|
97 | 99 | def test_send_request_to_bad_core(self): |
98 | | - unittest.SkipTest("This test makes no sense in a SolrCloud world") |
| 100 | + raise unittest.SkipTest("This test makes no sense in a SolrCloud world") |
99 | 101 |
|
100 | 102 | def test_invalid_collection(self): |
101 | 103 | self.assertRaises(SolrError, SolrCloud, self.zk, "core12345") |
|
0 commit comments