'md0.bitmap.allocated_pages': 1, 'md0.bitmap.page_size': 4, 'md0.bitmap.chunk_size': 65536 } self.assertPublishedMany(publish_mock, metrics) @patch.object(Collector, 'publish') def test_mdstat_raid5(self, publish_mock): MdStatCollector.MDSTAT_PATH = \ self.getFixturePath('mdstat_raid5') self.collector.collect() metrics = { 'md0.status.total_members': 3, 'md0.status.blocks': 39058432, 'md0.status.algorithm': 2, 'md0.status.superblock_version': 1.2, 'md0.status.raid_level': 5, 'md0.status.chunk_size': 524288, 'md0.status.actual_members': 3, 'md0.member_count.active': 3, 'md0.member_count.faulty': 0, 'md0.member_count.spare': 0 } self.assertPublishedMany(publish_mock, metrics) if __name__ == "__main__": unittest.main()
self.assertIn(key, concept.related) match = concept.related[key] self.assertIsInstance(match, skos.Concept) self.assertIn(concept, match.related) def testNarrower(self): concept = self.loader['http://portal.oceannet.org/test2'] key = self.getExternalResource('external2-dce.xml') self.assertIn(key, concept.narrower) match = concept.narrower[key] self.assertIsInstance(match, skos.Concept) self.assertIn(concept, match.broader) def testFlattening(self): self.loader.flat = True self.assertEqual(len(self.loader), 12) self.assertIn(self.getExternalResource('external2-dce.xml'), self.loader) class TestRDFUriNormalisation(TestRDFLoader): """ Test the uri normalisation functionality """ def getLoader(self, graph): def normalise_uri(uri): return uri.rstrip(u'/') return skos.RDFLoader(graph, normalise_uri=normalise_uri) if __name__ == '__main__': unittest.main(verbosity=2)
self.assertIn(concept, match.related) def testNarrower(self): concept = self.loader['http://portal.oceannet.org/test2'] key = self.getExternalResource('external2-dce.xml') self.assertIn(key, concept.narrower) match = concept.narrower[key] self.assertIsInstance(match, skos.Concept) self.assertIn(concept, match.broader) def testFlattening(self): self.loader.flat = True self.assertEqual(len(self.loader), 12) self.assertIn(self.getExternalResource('external2-dce.xml'), self.loader) class TestRDFUriNormalisation(TestRDFLoader): """ Test the uri normalisation functionality """ def getLoader(self, graph): def normalise_uri(uri): return uri.rstrip(u'/') return skos.RDFLoader(graph, normalise_uri=normalise_uri) if __name__ == '__main__': unittest.main(verbosity=2)
def insert_docs(): while not done: db.inventory.insert_one({}) t = threading.Thread(target=insert_docs) t.start() try: # Start Changestream Example 1 cursor = db.inventory.watch() document = next(cursor) # End Changestream Example 1 # Start Changestream Example 2 cursor = db.inventory.watch(full_document='updateLookup') document = next(cursor) # End Changestream Example 2 # Start Changestream Example 3 resume_token = document.get("_id") cursor = db.inventory.watch(resume_after=resume_token) document = next(cursor) # End Changestream Example 3 finally: done = True t.join() if __name__ == "__main__": unittest.main()
db = self.motor_client(ssl=self.ssl).perftest self.gridfs = motor_tornado.MotorGridFS(db) async def do_task(self): await gen.multi(insert_gridfs_file(self.gridfs, f) for f in self.files) class TestGridFsMultiFileDownload(_PerformanceTest): def setUp(self): super().setUp() sync_gridfs = GridFS(env.sync_cx.perftest) path = join(TEST_PATH, 'parallel', 'gridfs_multi') self.files = [join(path, s) for s in os.listdir(path)] for fname in self.files: with open(fname, 'rb') as gfile: sync_gridfs.put(gfile, filename=fname) self.gridfs = motor_tornado.MotorGridFS(self.cx.perftest) async def do_task(self): await gen.multi(read_gridfs_file(self.gridfs, f) for f in self.files) del _PerformanceTest # Don't run this base class as a test. if __name__ == "__main__": env.setup() unittest.main(verbosity=0) # Suppress dots in output.