MCPcopy Create free account
hub / github.com/mongodb/mongo-python-driver / test_threaded_writes

Method test_threaded_writes

test/test_gridfs_bucket.py:238–250  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

236 self.assertEqual(100 * [b"hello"], results)
237
238 def test_threaded_writes(self):
239 threads = []
240 for i in range(10):
241 threads.append(JustWrite(self.fs, 10))
242 threads[i].start()
243
244 joinall(threads)
245
246 fstr = self.fs.open_download_stream_by_name("test")
247 self.assertEqual(fstr.read(), b"hello")
248
249 # Should have created 100 versions of 'test' file
250 self.assertEqual(100, self.db.fs.files.count_documents({"filename": "test"}))
251
252 def test_get_last_version(self):
253 one = self.fs.upload_from_stream("test", b"foo")

Callers

nothing calls this directly

Calls 6

joinallFunction · 0.90
JustWriteClass · 0.70
startMethod · 0.45
readMethod · 0.45
count_documentsMethod · 0.45

Tested by

no test coverage detected