@@ -64,6 +64,10 @@ def tearDown(self):
6464 self .db = None
6565 self .connection = None
6666
67+ # Try to diagnose intermittent failure in tests on Jenkins
68+ cx = get_connection ()
69+ self .assertEqual (0 , cx .test .test_unique_threaded .count ())
70+
6771 def test_collection (self ):
6872 self .assertRaises (TypeError , Collection , self .db , 5 )
6973
@@ -198,16 +202,16 @@ def test_ensure_index(self):
198202 db .test .drop_indexes ()
199203
200204 def test_ensure_unique_index_threaded (self ):
201- db = self .db
202- db . test .drop ()
203- db . test .insert (({'foo' : i } for i in xrange (10000 )), safe = True )
205+ coll = self .db . test_unique_threaded
206+ coll .drop ()
207+ coll .insert (({'foo' : i } for i in xrange (10000 )), safe = True )
204208
205209 class Indexer (threading .Thread ):
206210 def run (self ):
207211 try :
208- db . test .ensure_index ('foo' , unique = True )
209- db . test .insert ({'foo' : 'bar' }, safe = True )
210- db . test .insert ({'foo' : 'bar' }, safe = True )
212+ coll .ensure_index ('foo' , unique = True )
213+ coll .insert ({'foo' : 'bar' }, safe = True )
214+ coll .insert ({'foo' : 'bar' }, safe = True )
211215 except OperationFailure :
212216 pass
213217
@@ -222,8 +226,8 @@ def run(self):
222226 for i in xrange (10 ):
223227 threads [i ].join ()
224228
225- self .assertEqual (10001 , db . test .count ())
226- db . test .drop ()
229+ self .assertEqual (10001 , coll .count ())
230+ coll .drop ()
227231
228232 def test_index_on_binary (self ):
229233 db = self .db
0 commit comments