コード例 #1
0
 def test_human_size(self):
     du = command_du.CommandDu()
     self.assertEqual(du._human_size_of_points(1), '24B')
     self.assertEqual(du._human_size_of_points(
         1023 // command_du._BYTES_PER_POINT), '1008B')
     self.assertEqual(du._human_size_of_points(
         1024 // (command_du._BYTES_PER_POINT - 1)), '1.0K')
コード例 #2
0
    def get_output(self, args, mock_stdout):
        self.accessor.drop_all_metrics()
        for metric in self.metrics:
            self.accessor.create_metric(
                self.make_metric(metric, self.metadata))

        cmd = command_du.CommandDu()

        parser = argparse.ArgumentParser(add_help=False)
        bg_utils.add_argparse_arguments(parser)
        cmd.add_arguments(parser)

        opts = parser.parse_args(args)
        cmd.run(self.accessor, opts)
        return mock_stdout.getvalue()
コード例 #3
0
ファイル: bgutil.py プロジェクト: fedj/biggraphite
    command_list,
    command_read,
    command_repair,
    command_shell,
    command_stats,
    command_syncdb,
    command_test,
    command_write,
)

COMMANDS = [
    command_clean.CommandClean(),
    command_copy.CommandCopy(),
    command_daemon.CommandDaemon(),
    command_delete.CommandDelete(),
    command_du.CommandDu(),
    command_graphite_web.CommandGraphiteWeb(),
    command_info.CommandInfo(),
    command_list.CommandList(),
    command_read.CommandRead(),
    command_repair.CommandRepair(),
    command_shell.CommandShell(),
    command_stats.CommandStats(),
    command_syncdb.CommandSyncdb(),
    command_test.CommandTest(),
    command_write.CommandWrite(),
]


def _parse_opts(args):
    """Parse command line arguments."""