def setup_package(tornado_warnings): """Run once by MotorTestCase before any tests. If 'warn', let Tornado log warnings. """ env.setup() if not tornado_warnings: suppress_tornado_warnings()
def run(self, test): env.setup() if not self.tornado_warnings: suppress_tornado_warnings() result = super(MotorTestRunner, self).run(test) env.teardown() return result
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, exit=False) # Suppress dots in output. print('=' * 20) sleep(10) unittest.main(verbosity=0)