Beispiel #1
0
 def test_good_args(self):
     result = get_chain_args(
         ['--one', 'one', '--two', 'two', '--three', 'three'])
     self.assertEqual({
         'one': 'one',
         'two': 'two',
         'three': 'three'
     }, result)
Beispiel #2
0
    def process_other_chain_args(self, args, other_args)-> {}:
        try:
            chain_args = get_chain_args(other_args)
        except ChainArgException as e:
            logger.error(str(e))
            logger.error('Aborting...')
            sys.exit(-1)

        if args.soft_time_limit:
            chain_args['soft_time_limit'] = args.soft_time_limit

        chain_args['chain'] = args.chain
        chain_args['plugins'] = args.plugins
        chain_args['sync'] = args.sync
        chain_args['submitter'] = getuser()
        chain_args['submission_dir'] = os.getcwd()
        chain_args['argv'] = sys.argv
        chain_args['json_file'] = args.json_file
        whitelist_arguments(['submitter', 'submission_dir', 'argv'])

        return chain_args
Beispiel #3
0
 def test_bad_key(self):
     with self.assertRaises(ChainArgException):
         get_chain_args(['--1one', 'one'])
Beispiel #4
0
 def test_missing_key(self):
     with self.assertRaises(ChainArgException):
         get_chain_args(['--one', 'one', 'two'])
     with self.assertRaises(ChainArgException):
         get_chain_args(['--one', 'one', 'two', '--three', 'three'])
Beispiel #5
0
 def test_no_extra_args(self):
     result = get_chain_args([])
     self.assertEqual({}, result)