@@ -409,13 +409,22 @@ 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+ path = os .path .join (SPARK_HOME , "python/test_support/hello" )
420+ self .sc .addFile (path , True )
421+ download_path = SparkFiles .get ("hello" )
422+ self .assertNotEqual (path , download_path )
423+ with open (download_path + "/hello.txt" ) as test_file :
424+ self .assertEqual ("Hello World!\n " , test_file .readline ())
425+ with open (download_path + "/sub_hello/sub_hello.txt" ) as test_file :
426+ self .assertEqual ("Sub Hello World!\n " , test_file .readline ())
427+
419428 def test_add_py_file_locally (self ):
420429 # To ensure that we're actually testing addPyFile's effects, check that
421430 # this fails due to `userlibrary` not being on the Python path:
@@ -514,7 +523,7 @@ def test_transforming_pickle_file(self):
514523
515524 def test_cartesian_on_textfile (self ):
516525 # Regression test for
517- path = os .path .join (SPARK_HOME , "python/test_support/hello.txt" )
526+ path = os .path .join (SPARK_HOME , "python/test_support/hello/hello .txt" )
518527 a = self .sc .textFile (path )
519528 result = a .cartesian (a ).collect ()
520529 (x , y ) = result [0 ]
@@ -751,7 +760,7 @@ def test_zip_with_different_serializers(self):
751760 b = b ._reserialize (MarshalSerializer ())
752761 self .assertEqual (a .zip (b ).collect (), [(0 , 100 ), (1 , 101 ), (2 , 102 ), (3 , 103 ), (4 , 104 )])
753762 # regression test for SPARK-4841
754- path = os .path .join (SPARK_HOME , "python/test_support/hello.txt" )
763+ path = os .path .join (SPARK_HOME , "python/test_support/hello/hello .txt" )
755764 t = self .sc .textFile (path )
756765 cnt = t .count ()
757766 self .assertEqual (cnt , t .zip (t ).count ())
@@ -1214,7 +1223,7 @@ def test_oldhadoop(self):
12141223 ei = [(1 , u'aa' ), (1 , u'aa' ), (2 , u'aa' ), (2 , u'bb' ), (2 , u'bb' ), (3 , u'cc' )]
12151224 self .assertEqual (ints , ei )
12161225
1217- hellopath = os .path .join (SPARK_HOME , "python/test_support/hello.txt" )
1226+ hellopath = os .path .join (SPARK_HOME , "python/test_support/hello/hello .txt" )
12181227 oldconf = {"mapred.input.dir" : hellopath }
12191228 hello = self .sc .hadoopRDD ("org.apache.hadoop.mapred.TextInputFormat" ,
12201229 "org.apache.hadoop.io.LongWritable" ,
@@ -1233,7 +1242,7 @@ def test_newhadoop(self):
12331242 ei = [(1 , u'aa' ), (1 , u'aa' ), (2 , u'aa' ), (2 , u'bb' ), (2 , u'bb' ), (3 , u'cc' )]
12341243 self .assertEqual (ints , ei )
12351244
1236- hellopath = os .path .join (SPARK_HOME , "python/test_support/hello.txt" )
1245+ hellopath = os .path .join (SPARK_HOME , "python/test_support/hello/hello .txt" )
12371246 newconf = {"mapred.input.dir" : hellopath }
12381247 hello = self .sc .newAPIHadoopRDD ("org.apache.hadoop.mapreduce.lib.input.TextInputFormat" ,
12391248 "org.apache.hadoop.io.LongWritable" ,
0 commit comments