File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -165,11 +165,17 @@ class TestAddFile(PySparkTestCase):
165
165
def test_add_py_file (self ):
166
166
# To ensure that we're actually testing addPyFile's effects, check that
167
167
# this job fails due to `userlibrary` not being on the Python path:
168
+ # disable logging in log4j temporarily
169
+ log4j = self .sc ._jvm .org .apache .log4j
170
+ old_level = log4j .LogManager .getRootLogger ().getLevel ()
171
+ log4j .LogManager .getRootLogger ().setLevel (log4j .Level .FATAL )
168
172
def func (x ):
169
173
from userlibrary import UserClass
170
174
return UserClass ().hello ()
171
175
self .assertRaises (Exception ,
172
176
self .sc .parallelize (range (2 )).map (func ).first )
177
+ log4j .LogManager .getRootLogger ().setLevel (old_level )
178
+
173
179
# Add the file, so the job should now succeed:
174
180
path = os .path .join (SPARK_HOME , "python/test_support/userlibrary.py" )
175
181
self .sc .addPyFile (path )
You can’t perform that action at this time.
0 commit comments