@@ -409,13 +409,23 @@ def func(x):
409409 self .assertEqual ("Hello World!" , res )
410410
411411 def test_add_file_locally (self ):
412- path = os .path .join (SPARK_HOME , "python/test_support/hello.txt" )
412+ path = os .path .join (SPARK_HOME , "python/test_support/hello/hello .txt" )
413413 self .sc .addFile (path )
414414 download_path = SparkFiles .get ("hello.txt" )
415415 self .assertNotEqual (path , download_path )
416416 with open (download_path ) as test_file :
417417 self .assertEqual ("Hello World!\n " , test_file .readline ())
418418
419+ def test_add_file_recursively_locally (self ):
420+ path = os .path .join (SPARK_HOME , "python/test_support/hello" )
421+ self .sc .addFile (path , True )
422+ download_path = SparkFiles .get ("hello" )
423+ self .assertNotEqual (path , download_path )
424+ with open (download_path + "/hello.txt" ) as test_file :
425+ self .assertEqual ("Hello World!\n " , test_file .readline ())
426+ with open (download_path + "/sub_hello/sub_hello.txt" ) as test_file :
427+ self .assertEqual ("Sub Hello World!\n " , test_file .readline ())
428+
419429 def test_add_py_file_locally (self ):
420430 # To ensure that we're actually testing addPyFile's effects, check that
421431 # this fails due to `userlibrary` not being on the Python path:
@@ -514,7 +524,7 @@ def test_transforming_pickle_file(self):
514524
515525 def test_cartesian_on_textfile (self ):
516526 # Regression test for
517- path = os .path .join (SPARK_HOME , "python/test_support/hello.txt" )
527+ path = os .path .join (SPARK_HOME , "python/test_support/hello/hello .txt" )
518528 a = self .sc .textFile (path )
519529 result = a .cartesian (a ).collect ()
520530 (x , y ) = result [0 ]
@@ -751,7 +761,7 @@ def test_zip_with_different_serializers(self):
751761 b = b ._reserialize (MarshalSerializer ())
752762 self .assertEqual (a .zip (b ).collect (), [(0 , 100 ), (1 , 101 ), (2 , 102 ), (3 , 103 ), (4 , 104 )])
753763 # regression test for SPARK-4841
754- path = os .path .join (SPARK_HOME , "python/test_support/hello.txt" )
764+ path = os .path .join (SPARK_HOME , "python/test_support/hello/hello .txt" )
755765 t = self .sc .textFile (path )
756766 cnt = t .count ()
757767 self .assertEqual (cnt , t .zip (t ).count ())
@@ -1214,7 +1224,7 @@ def test_oldhadoop(self):
12141224 ei = [(1 , u'aa' ), (1 , u'aa' ), (2 , u'aa' ), (2 , u'bb' ), (2 , u'bb' ), (3 , u'cc' )]
12151225 self .assertEqual (ints , ei )
12161226
1217- hellopath = os .path .join (SPARK_HOME , "python/test_support/hello.txt" )
1227+ hellopath = os .path .join (SPARK_HOME , "python/test_support/hello/hello .txt" )
12181228 oldconf = {"mapred.input.dir" : hellopath }
12191229 hello = self .sc .hadoopRDD ("org.apache.hadoop.mapred.TextInputFormat" ,
12201230 "org.apache.hadoop.io.LongWritable" ,
@@ -1233,7 +1243,7 @@ def test_newhadoop(self):
12331243 ei = [(1 , u'aa' ), (1 , u'aa' ), (2 , u'aa' ), (2 , u'bb' ), (2 , u'bb' ), (3 , u'cc' )]
12341244 self .assertEqual (ints , ei )
12351245
1236- hellopath = os .path .join (SPARK_HOME , "python/test_support/hello.txt" )
1246+ hellopath = os .path .join (SPARK_HOME , "python/test_support/hello/hello .txt" )
12371247 newconf = {"mapred.input.dir" : hellopath }
12381248 hello = self .sc .newAPIHadoopRDD ("org.apache.hadoop.mapreduce.lib.input.TextInputFormat" ,
12391249 "org.apache.hadoop.io.LongWritable" ,
0 commit comments