Пример #1
0
def main(args, config):
    options, filenames = parse_options(args)

    assert 'publisher_class' in config
    Publisher = config['publisher_class']

    parser = FileParser(options.__dict__, filenames)
    with Publisher(options.host) as pub:
        for row in parser.run():
            pub.publish(row)
Пример #2
0
    def test_file_parse(self):
        options = {'period': 40, 'condition': 15}
        parser = FileParser(options, [self.temp.name])
        result = [i for i in parser.run()]

        self.assertEqual(len(result), 1)