Skip to content

Commit e20757e

Browse files
committed
Change database path in python coverage module
1 parent 59cf7b4 commit e20757e

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

utbot-python/src/main/kotlin/org/utbot/python/PythonEvaluation.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,18 @@ fun startEvaluationProcess(input: EvaluationInput): EvaluationProcess {
6464
tag = "out_" + input.method.name + ".py",
6565
addToCleaner = false
6666
)
67+
val coverageDatabasePath = TemporaryFileManager.assignTemporaryFile(
68+
tag = "coverage_db_" + input.method.name,
69+
addToCleaner = false,
70+
)
6771
val runCode = PythonCodeGenerator.generateRunFunctionCode(
6872
input.method,
6973
input.methodArguments,
7074
input.directoriesForSysPath,
7175
input.moduleToImport,
7276
input.additionalModulesToImport,
73-
fileForOutput.path.replace("\\", "\\\\")
77+
fileForOutput.path.replace("\\", "\\\\"),
78+
coverageDatabasePath.absolutePath
7479
)
7580
val fileWithCode = TemporaryFileManager.createTemporaryFile(
7681
runCode,

utbot-python/src/main/kotlin/org/utbot/python/code/CodeGen.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ object PythonCodeGenerator {
2020
directoriesForSysPath: Set<String>,
2121
moduleToImport: String,
2222
additionalModules: Set<String> = emptySet(),
23-
fileForOutputName: String
23+
fileForOutputName: String,
24+
coverageDatabasePath: String,
2425
): String {
2526
val context = UtContext(this::class.java.classLoader)
2627
withUtContext(context) {
@@ -36,7 +37,8 @@ object PythonCodeGenerator {
3637
directoriesForSysPath,
3738
moduleToImport,
3839
additionalModules,
39-
fileForOutputName
40+
fileForOutputName,
41+
coverageDatabasePath,
4042
)
4143
}
4244
}

utbot-python/src/main/kotlin/org/utbot/python/framework/codegen/model/PythonCodeGenerator.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,8 @@ class PythonCodeGenerator(
104104
directoriesForSysPath: Set<String>,
105105
moduleToImport: String,
106106
additionalModules: Set<String> = emptySet(),
107-
fileForOutputName: String
107+
fileForOutputName: String,
108+
coverageDatabasePath: String,
108109
): String {
109110
val cgRendererContext = CgRendererContext.fromCgContext(context)
110111
val printer = CgPrinterImpl()
@@ -144,13 +145,14 @@ class PythonCodeGenerator(
144145
)
145146

146147
val fullpath = CgLiteral(pythonStrClassId, "'${method.moduleFilename}'")
147-
148148
val outputPath = CgLiteral(pythonStrClassId, "'$fileForOutputName'")
149+
val databasePath = CgLiteral(pythonStrClassId, "'$coverageDatabasePath'")
149150

150151
val executorCall = CgPythonFunctionCall(
151152
pythonNoneClassId,
152153
executorFunctionName,
153154
listOf(
155+
databasePath,
154156
functionName,
155157
args,
156158
kwargs,

0 commit comments

Comments
 (0)