File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed
utbot-python/src/main/kotlin/org/utbot/python Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -39,7 +39,6 @@ class PythonTestCaseGenerator(
3939 private val fileOfMethod : String ,
4040 private val isCancelled : () -> Boolean ,
4141 private val timeoutForRun : Long = 0 ,
42- private val until : Long = 0 ,
4342 private val sourceFileContent : String ,
4443 private val mypyStorage : MypyAnnotationStorage ,
4544 private val mypyReportLine : List <MypyReportLine >,
@@ -145,7 +144,7 @@ class PythonTestCaseGenerator(
145144 }.take(maxSubstitutions)
146145 }
147146
148- fun generate (methodDescription : PythonMethodHeader ): PythonTestSet {
147+ fun generate (methodDescription : PythonMethodHeader , until : Long ): PythonTestSet {
149148 storageForMypyMessages.clear()
150149
151150 val typeStorage = PythonTypeStorage .get(mypyStorage)
Original file line number Diff line number Diff line change @@ -98,15 +98,17 @@ object PythonTestGenerationProcessor {
9898 fileOfMethod = pythonFilePath,
9999 isCancelled = isCanceled,
100100 timeoutForRun = timeoutForRun,
101- until = startTime + timeout,
102101 sourceFileContent = pythonFileContent,
103102 mypyStorage = mypyStorage,
104103 mypyReportLine = report,
105104 mypyConfigFile = mypyConfigFile,
106105 )
107106
108- val tests = pythonMethods.map { method ->
109- testCaseGenerator.generate(method)
107+ val until = startTime + timeout
108+ val tests = pythonMethods.mapIndexed { index, method ->
109+ val methodsLeft = pythonMethods.size - index
110+ val localUntil = (until - System .currentTimeMillis()) / methodsLeft + System .currentTimeMillis()
111+ testCaseGenerator.generate(method, localUntil)
110112 }
111113
112114 val (notEmptyTests, emptyTestSets) = tests.partition { it.executions.isNotEmpty() }
You can’t perform that action at this time.
0 commit comments