def setUp(self): super(TestTiming, self).setUp() self.app.timing_data = [] self.app.client_manager.compute = FakeGenericClient( endpoint=fakes.AUTH_URL, token=fakes.AUTH_TOKEN, ) self.app.client_manager.volume = FakeGenericClient( endpoint=fakes.AUTH_URL, token=fakes.AUTH_TOKEN, ) # Get the command object to test self.cmd = timing.Timing(self.app, None)
def clean_up(self, cmd, result, err): self.log.debug('clean_up %s: %s', cmd.__class__.__name__, err or '') # Process collected timing data if self.options.timing: # Get session data self.timing_data.extend( self.client_manager.session.get_timings(), ) # Use the Timing pseudo-command to generate the output tcmd = timing.Timing(self, self.options) tparser = tcmd.get_parser('Timing') # If anything other than prettytable is specified, force csv format = 'table' # Check the formatter used in the actual command if hasattr(cmd, 'formatter') \ and cmd.formatter != cmd._formatter_plugins['table'].obj: format = 'csv' sys.stdout.write('\n') targs = tparser.parse_args(['-f', format]) tcmd.run(targs)