Esempio n. 1
0
    def test_benchmark_meta(self, set_meta, set_data):
        key = 'foo'
        value = 'bar'
        units = 'bogomips'
        direction = 'desc'

        # Test with only a key/value pair
        Benchmark.set_meta(key, value)
        set_meta.assert_called_once_with(key, value)

        # set_data.side_effect = [True]
        # set_data.assert_has_calls([
        #     mock.call({'meta.%s' % key: value})
        #     #set_data({'meta.asdf': value})
        # ])
        # Benchmark.set_data({'meta.%s.value' % key: value})
        # Benchmark.set_data({'meta.%s.units' % key: units})
        # Benchmark.set_data({'meta.%s.direction' % key: direction})
        # set_data.reset_mock()
        set_meta.reset_mock()

        # Test with all parameters
        Benchmark.set_meta(key, value, units, direction)
        set_meta.assert_called_once_with(key, value, units, direction)
        pass
Esempio n. 2
0
def main():
    parser = argparse.ArgumentParser(
        description='Set a meta key of the benchmark run.')
    parser.add_argument("key",
                        metavar='key',
                        help='The key of the data to store.')

    parser.add_argument("value",
                        metavar='value',
                        help='The value of the data to store.')

    args = parser.parse_args()

    Benchmark.set_meta(args.key, args.value)