示例#1
0
    def test_find_hadoop_streaming_jar(self):
        # not just any jar will do
        with patch.object(os, "walk", return_value=[("/some_dir", None, "mason.jar")]):
            self.assertEqual(find_hadoop_streaming_jar("/some_dir"), None)

        # should match streaming jar
        with patch.object(os, "walk", return_value=[("/some_dir", None, "hadoop-0.20.2-streaming.jar")]):
            self.assertEqual(find_hadoop_streaming_jar("/some_dir"), None)

        # shouldn't find anything in an empty dir
        with patch.object(os, "walk", return_value=[]):
            self.assertEqual(find_hadoop_streaming_jar("/some_dir"), None)
示例#2
0
    def test_find_hadoop_streaming_jar(self):
        # not just any jar will do
        with patch.object(os, 'walk', return_value=[
            ('/some_dir', None, 'mason.jar')]):
            self.assertEqual(find_hadoop_streaming_jar('/some_dir'), None)

        # should match streaming jar
        with patch.object(os, 'walk', return_value=[
            ('/some_dir', None, 'hadoop-0.20.2-streaming.jar')]):
            self.assertEqual(find_hadoop_streaming_jar('/some_dir'), None)

        # shouldn't find anything in an empty dir
        with patch.object(os, 'walk', return_value=[]):
            self.assertEqual(find_hadoop_streaming_jar('/some_dir'), None)
示例#3
0
    def test_find_hadoop_streaming_jar(self):
        # shouldn't find anything if nothing's there
        assert_equal(find_hadoop_streaming_jar(self.tmp_dir), None)

        jar_dir = os.path.join(self.tmp_dir, 'a', 'b', 'c')
        os.makedirs(jar_dir)
        empty_dir = os.path.join(self.tmp_dir, 'empty')
        os.makedirs(empty_dir)

        # not just any jar will do
        mason_jar_path = os.path.join(jar_dir, 'mason.jar')
        open(mason_jar_path, 'w').close()
        assert_equal(find_hadoop_streaming_jar(self.tmp_dir), None)

        # should match streaming jar
        streaming_jar_path = os.path.join(
            jar_dir, 'hadoop-0.20.2-streaming.jar')
        open(streaming_jar_path, 'w').close()
        assert_equal(find_hadoop_streaming_jar(self.tmp_dir),
                     streaming_jar_path)

        # shouldn't find anything if we look in the wrong dir
        assert_equal(find_hadoop_streaming_jar(empty_dir), None)
示例#4
0
    def test_find_hadoop_streaming_jar(self):
        # shouldn't find anything if nothing's there
        assert_equal(find_hadoop_streaming_jar(self.tmp_dir), None)

        jar_dir = os.path.join(self.tmp_dir, 'a', 'b', 'c')
        os.makedirs(jar_dir)
        empty_dir = os.path.join(self.tmp_dir, 'empty')
        os.makedirs(empty_dir)

        # not just any jar will do
        mason_jar_path = os.path.join(jar_dir, 'mason.jar')
        open(mason_jar_path, 'w').close()
        assert_equal(find_hadoop_streaming_jar(self.tmp_dir), None)

        # should match streaming jar
        streaming_jar_path = os.path.join(jar_dir,
                                          'hadoop-0.20.2-streaming.jar')
        open(streaming_jar_path, 'w').close()
        assert_equal(find_hadoop_streaming_jar(self.tmp_dir),
                     streaming_jar_path)

        # shouldn't find anything if we look in the wrong dir
        assert_equal(find_hadoop_streaming_jar(empty_dir), None)