Skip to content

Commit 0682dc8

Browse files
committed
fix: Restore the original skipIf behavior in tests/test_cloud module
1 parent 9ba9512 commit 0682dc8

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

tests/test_cloud.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,15 @@
22
import unittest
33
from typing import ClassVar
44

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-
115
from pysolr import SolrCloud, SolrError, ZooKeeper, json
126

137
from .test_client import SolrTestCase
148

9+
try:
10+
from kazoo.exceptions import KazooException
11+
except ImportError:
12+
KazooException = None
13+
1514

1615
class ProxyZooKeeper(ZooKeeper):
1716
"""
@@ -59,6 +58,9 @@ def getHosts(self, collname, only_leader=False, seen_aliases=None):
5958
return mapped
6059

6160

61+
@unittest.skipIf(
62+
KazooException is None, "kazoo is not installed; skipping SolrCloud tests"
63+
)
6264
class SolrCloudTestCase(SolrTestCase):
6365
@classmethod
6466
def setUpClass(cls):
@@ -92,10 +94,10 @@ def test_custom_results_class(self):
9294
self.assertIn("response", results)
9395

9496
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")
9698

9799
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")
99101

100102
def test_invalid_collection(self):
101103
self.assertRaises(SolrError, SolrCloud, self.zk, "core12345")

0 commit comments

Comments
 (0)