@@ -19,7 +19,6 @@ package org.apache.spark.scheduler
1919
2020import java .util .Properties
2121
22- import org .apache .spark .util .ResetSystemProperties
2322import org .scalatest .FunSuite
2423
2524import org .apache .spark ._
@@ -110,8 +109,7 @@ class FakeTaskSetManager(
110109 }
111110}
112111
113- class TaskSchedulerImplSuite extends FunSuite with ResetSystemProperties with LocalSparkContext
114- with Logging {
112+ class TaskSchedulerImplSuite extends FunSuite with LocalSparkContext with Logging {
115113
116114 def createDummyTaskSetManager (priority : Int , stage : Int , numTasks : Int , cs : TaskSchedulerImpl ,
117115 taskSet : TaskSet ): FakeTaskSetManager = {
@@ -164,12 +162,12 @@ class TaskSchedulerImplSuite extends FunSuite with ResetSystemProperties with Lo
164162 }
165163
166164 test(" Fair Scheduler Test" ) {
167- sc = new SparkContext (" local" , " TaskSchedulerImplSuite" )
165+ val xmlPath = getClass.getClassLoader.getResource(" fairscheduler.xml" ).getFile()
166+ val conf = new SparkConf ().set(" spark.scheduler.allocation.file" , xmlPath)
167+ sc = new SparkContext (" local" , " TaskSchedulerImplSuite" , conf)
168168 val taskScheduler = new TaskSchedulerImpl (sc)
169169 val taskSet = FakeTask .createTaskSet(1 )
170170
171- val xmlPath = getClass.getClassLoader.getResource(" fairscheduler.xml" ).getFile()
172- System .setProperty(" spark.scheduler.allocation.file" , xmlPath)
173171 val rootPool = new Pool (" " , SchedulingMode .FAIR , 0 , 0 )
174172 val schedulableBuilder = new FairSchedulableBuilder (rootPool, sc.conf)
175173 schedulableBuilder.buildPools()
0 commit comments