Skip to content

Commit 2ddae26

Browse files
author
Frederick Ross
committed
Fix changes from David.
1 parent e092e70 commit 2ddae26

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

splunklib/client.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ class IncomparableException(Exception):
113113
class JobNotReadyException(Exception):
114114
pass
115115

116-
class AmbiguousReference(ValueError):
116+
class AmbiguousReferenceException(ValueError):
117117
pass
118118

119119
def trailing(template, *targets):
@@ -893,7 +893,7 @@ def __contains__(self, name):
893893
return True
894894
except KeyError:
895895
return False
896-
except AmbiguousReference:
896+
except AmbiguousReferenceException:
897897
return True
898898

899899
def __getitem__(self, key):
@@ -954,7 +954,7 @@ def __getitem__(self, key):
954954
response = self.get(key, owner=ns.owner, app=ns.app)
955955
entries = self._load_list(response)
956956
if len(entries) > 1:
957-
raise AmbiguousReference("Found multiple entities named '%s'; please specify a namespace." % key)
957+
raise AmbiguousReferenceException("Found multiple entities named '%s'; please specify a namespace." % key)
958958
elif len(entries) == 0:
959959
raise KeyError(key)
960960
else:
@@ -1521,7 +1521,7 @@ def __contains__(self, key):
15211521
return True
15221522
except KeyError:
15231523
return False
1524-
except AmbiguousReference:
1524+
except AmbiguousReferenceException:
15251525
return True
15261526

15271527

tests/test_index.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,13 @@ def test_read(self):
5757

5858
def test_disable(self):
5959
self.index.disable()
60-
testlib.restart(self.service)
60+
# testlib.restart(self.service)
6161
self.index.refresh()
6262
self.assertEqual(self.index['disabled'], '1')
6363

6464
def test_enable(self):
6565
self.index.enable()
66-
testlib.restart(self.service)
66+
# testlib.restart(self.service)
6767
self.index.refresh()
6868
self.assertEqual(self.index['disabled'], '0')
6969

tests/test_saved_search.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -196,11 +196,7 @@ def test_dispatch(self):
196196
job = saved_search.dispatch()
197197
while not job.isReady():
198198
pass
199-
try:
200-
job.preview().close()
201-
except ValueError:
202-
pass # Probably not in a state that we can actually get
203-
# events from yet.
199+
job.preview().close()
204200
job.cancel()
205201

206202
# Dispatch with some additional options
@@ -239,27 +235,31 @@ def contains(history, sid):
239235
return sid in [job.sid for job in history]
240236

241237
job1 = saved_search.dispatch()
242-
sleep(1)
238+
while not job1.isReady():
239+
sleep(1)
243240
history = saved_search.history()
244241
self.assertEqual(len(history), 1)
245242
self.assertTrue(contains(history, job1.sid))
246243

247244
job2 = saved_search.dispatch()
248-
sleep(1)
245+
while not job2.isReady():
246+
sleep(1)
249247
history = saved_search.history()
250248
self.assertEqual(len(history), 2)
251249
self.assertTrue(contains(history, job1.sid))
252250
self.assertTrue(contains(history, job2.sid))
253251

254252
job1.cancel()
255-
sleep(1)
253+
while job1.sid in service.jobs:
254+
sleep(1)
256255
history = saved_search.history()
257256
self.assertEqual(len(history), 1)
258257
self.assertFalse(contains(history, job1.sid))
259258
self.assertTrue(contains(history, job2.sid))
260259

261260
job2.cancel()
262-
sleep(1)
261+
while job2.sid in service.jobs:
262+
sleep(1)
263263
history = saved_search.history()
264264
self.assertEqual(len(history), 0)
265265
self.assertFalse(contains(history, job1.sid))

0 commit comments

Comments
 (0)