コード例 #1
0
ファイル: cli.py プロジェクト: ACamilka/subscription
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
ファイル: tests.py プロジェクト: ACamilka/subscription
    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)