Skip to content

Commit cdce106

Browse files
committed
Add cli processor for sbft
1 parent a820147 commit cdce106

File tree

5 files changed

+18
-8
lines changed

5 files changed

+18
-8
lines changed

utbot-cli-python/src/main/kotlin/org/utbot/cli/language/python/Application.kt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import mu.KotlinLogging
1010
import org.apache.logging.log4j.LogManager
1111
import org.apache.logging.log4j.core.config.Configurator
1212
import org.slf4j.event.Level
13+
import org.utbot.cli.language.python.sbft.SbftGenerateTestsCommand
1314
import java.util.*
1415
import kotlin.system.exitProcess
1516

@@ -29,10 +30,13 @@ class UtBotPythonCli : CliktCommand(name = "UnitTestBot Python Command Line Inte
2930

3031
fun main(args: Array<String>) = try {
3132
UtBotPythonCli().subcommands(
32-
PythonGenerateTestsCommand(),
33-
PythonRunTestsCommand(),
34-
PythonTypeInferenceCommand()
33+
SbftGenerateTestsCommand()
3534
).main(args)
35+
// UtBotPythonCli().subcommands(
36+
// PythonGenerateTestsCommand(),
37+
// PythonRunTestsCommand(),
38+
// PythonTypeInferenceCommand()
39+
// ).main(args)
3640
} catch (ex: Throwable) {
3741
ex.printStackTrace()
3842
exitProcess(1)

utbot-python-executor/src/main/python/utbot_executor/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "utbot-executor"
3-
version = "1.9.0.dev10"
3+
version = "1.9.0"
44
description = ""
55
authors = ["Vyacheslav Tamarin <vyacheslav.tamarin@yandex.ru>"]
66
readme = "README.md"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.9.0.dev10
1+
1.9.0

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class PythonTestGenerationConfig(
2323
val timeout: Long,
2424
val timeoutForRun: Long,
2525
val testFramework: TestFramework,
26-
val testSourceRootPath: Path,
26+
val testSourceRootPath: Path?,
2727
val withMinimization: Boolean,
2828
val isCanceled: () -> Boolean,
2929
val runtimeExceptionTestsBehaviour: RuntimeExceptionTestsBehaviour,

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,13 @@ abstract class PythonTestGenerationProcessor {
9898
return notEmptyTests
9999
}
100100

101-
fun testCodeGenerate(testSets: List<PythonTestSet>): String {
101+
fun testCodeGenerateSplitImports(testSets: List<PythonTestSet>): Pair<String, Set<PythonImport>> {
102+
val allImports = collectImports(testSets)
103+
val code = testCodeGenerate(testSets, true)
104+
return code to allImports
105+
}
106+
107+
fun testCodeGenerate(testSets: List<PythonTestSet>, skipImports: Boolean = false): String {
102108
val containingClassName = getContainingClassName(testSets)
103109
val classId = PythonClassId(configuration.testFileInformation.moduleName, containingClassName)
104110

@@ -123,7 +129,7 @@ abstract class PythonTestGenerationProcessor {
123129
methodIds[testSet.method] as ExecutableId to params
124130
}.toMutableMap()
125131

126-
val allImports = collectImports(testSets)
132+
val allImports = if (skipImports) emptySet() else collectImports(testSets)
127133

128134
val context = UtContext(this::class.java.classLoader)
129135
withUtContext(context) {

0 commit comments

Comments
 (0)