Example #1
0
File: bin.py Project: 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
Example #2
0
 def test_convert_to_list(self):
     assert_equal(combine_cmds('sort', ('grep', '-E')), ['grep', '-E'])
Example #3
0
 def test_parse_empty_string(self):
     assert_equal(combine_cmds(''), [])
Example #4
0
 def test_parse_string(self):
     assert_equal(combine_cmds('sort', 'grep', 'cat'), ['cat'])
     assert_equal(combine_cmds(['python'], 'python -S'), ['python', '-S'])
Example #5
0
 def test_all_None(self):
     assert_equal(combine_cmds(None, None, None), None)
Example #6
0
 def test_picks_last_value(self):
     assert_equal(combine_cmds(['sort'], ['grep'], ['cat']), ['cat'])
Example #7
0
 def test_empty(self):
     assert_equal(combine_cmds(), None)
Example #8
0
 def test_all_None(self):
     self.assertEqual(combine_cmds(None, None, None), None)
Example #9
0
 def test_empty(self):
     self.assertEqual(combine_cmds(), None)
Example #10
0
 def test_unicode(self):
     self.assertEqual(combine_cmds(u"wunderbar!"), ["wunderbar!"])
Example #11
0
 def test_convert_to_list(self):
     self.assertEqual(combine_cmds("sort", ("grep", "-E")), ["grep", "-E"])
Example #12
0
 def test_parse_empty_string(self):
     self.assertEqual(combine_cmds(""), [])
Example #13
0
 def test_parse_string(self):
     self.assertEqual(combine_cmds("sort", "grep", "cat"), ["cat"])
     self.assertEqual(combine_cmds(["python"], "python -S"), ["python", "-S"])
Example #14
0
 def test_picks_last_value(self):
     self.assertEqual(combine_cmds(["sort"], ["grep"], ["cat"]), ["cat"])
Example #15
0
 def test_unicode(self):
     self.assertEqual(combine_cmds(u'wunderbar!'), ['wunderbar!'])
Example #16
0
 def test_empty(self):
     self.assertEqual(combine_cmds(), None)