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):
165165 def test_add_py_file (self ):
166166 # To ensure that we're actually testing addPyFile's effects, check that
167167 # 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 )
168172 def func (x ):
169173 from userlibrary import UserClass
170174 return UserClass ().hello ()
171175 self .assertRaises (Exception ,
172176 self .sc .parallelize (range (2 )).map (func ).first )
177+ log4j .LogManager .getRootLogger ().setLevel (old_level )
178+
173179 # Add the file, so the job should now succeed:
174180 path = os .path .join (SPARK_HOME , "python/test_support/userlibrary.py" )
175181 self .sc .addPyFile (path )
You can’t perform that action at this time.
0 commit comments