示例#1
0
文件: bin.py 项目: Affirm/mrjob
    def _fix_opt(self, opt_key, opt_value, source):
        """Check sh_bin"""
        opt_value = super(MRJobBinRunner, self)._fix_opt(
            opt_key, opt_value, source)

        # check that sh_bin doesn't have too many args
        if opt_key == 'sh_bin':
            # opt_value is usually a string, combiner makes it a list of args
            sh_bin = combine_cmds(opt_value)

            # empty sh_bin just means to use the default, see #1926

            # make these hard requirements in v0.7.0?
            if len(sh_bin) > 1 and not os.path.isabs(sh_bin[0]):
                log.warning('sh_bin (from %s) should use an absolute path'
                            ' if you want it to take arguments' % source)
            elif len(sh_bin) > 2:
                log.warning('sh_bin (from %s) should not take more than one'
                            ' argument' % source)

        return opt_value
示例#2
0
文件: conf_test.py 项目: gimlids/LTPM
 def test_convert_to_list(self):
     assert_equal(combine_cmds('sort', ('grep', '-E')), ['grep', '-E'])
示例#3
0
文件: conf_test.py 项目: gimlids/LTPM
 def test_parse_empty_string(self):
     assert_equal(combine_cmds(''), [])
示例#4
0
文件: conf_test.py 项目: gimlids/LTPM
 def test_parse_string(self):
     assert_equal(combine_cmds('sort', 'grep', 'cat'), ['cat'])
     assert_equal(combine_cmds(['python'], 'python -S'), ['python', '-S'])
示例#5
0
文件: conf_test.py 项目: gimlids/LTPM
 def test_all_None(self):
     assert_equal(combine_cmds(None, None, None), None)
示例#6
0
文件: conf_test.py 项目: gimlids/LTPM
 def test_picks_last_value(self):
     assert_equal(combine_cmds(['sort'], ['grep'], ['cat']), ['cat'])
示例#7
0
文件: conf_test.py 项目: gimlids/LTPM
 def test_empty(self):
     assert_equal(combine_cmds(), None)
示例#8
0
文件: test_conf.py 项目: icio/mrjob
 def test_all_None(self):
     self.assertEqual(combine_cmds(None, None, None), None)
示例#9
0
文件: test_conf.py 项目: icio/mrjob
 def test_empty(self):
     self.assertEqual(combine_cmds(), None)
示例#10
0
文件: test_conf.py 项目: nyccto/mrjob
 def test_unicode(self):
     self.assertEqual(combine_cmds(u"wunderbar!"), ["wunderbar!"])
示例#11
0
文件: test_conf.py 项目: nyccto/mrjob
 def test_convert_to_list(self):
     self.assertEqual(combine_cmds("sort", ("grep", "-E")), ["grep", "-E"])
示例#12
0
文件: test_conf.py 项目: nyccto/mrjob
 def test_parse_empty_string(self):
     self.assertEqual(combine_cmds(""), [])
示例#13
0
文件: test_conf.py 项目: nyccto/mrjob
 def test_parse_string(self):
     self.assertEqual(combine_cmds("sort", "grep", "cat"), ["cat"])
     self.assertEqual(combine_cmds(["python"], "python -S"), ["python", "-S"])
示例#14
0
文件: test_conf.py 项目: nyccto/mrjob
 def test_picks_last_value(self):
     self.assertEqual(combine_cmds(["sort"], ["grep"], ["cat"]), ["cat"])
示例#15
0
 def test_unicode(self):
     self.assertEqual(combine_cmds(u'wunderbar!'), ['wunderbar!'])
示例#16
0
 def test_empty(self):
     self.assertEqual(combine_cmds(), None)