Skip to content

Commit bd81d2e

Browse files
committed
Forks in python fuzzing and refactoring (#2588)
(cherry picked from commit 45e1d37)
1 parent 8119ae3 commit bd81d2e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+420
-788
lines changed

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

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ class PythonCliProcessor(
1010
private val output: String,
1111
private val logger: KLogger,
1212
private val coverageOutput: String?,
13+
private val executionCounterOutput: String?,
1314
) : PythonTestGenerationProcessor() {
1415

1516
override fun saveTests(testsCode: String) {
@@ -22,9 +23,18 @@ class PythonCliProcessor(
2223
)
2324
}
2425

26+
private fun getExecutionsNumber(testSets: List<PythonTestSet>): Int {
27+
return testSets.sumOf { it.executionsNumber }
28+
}
29+
2530
override fun processCoverageInfo(testSets: List<PythonTestSet>) {
26-
val coverageReport = getStringCoverageInfo(testSets)
27-
val output = coverageOutput ?: return
28-
writeToFileAndSave(output, coverageReport)
31+
coverageOutput?.let { output ->
32+
val coverageReport = getStringCoverageInfo(testSets)
33+
writeToFileAndSave(output, coverageReport)
34+
}
35+
executionCounterOutput?.let { executionOutput ->
36+
val executionReport = "{\"executions\": ${getExecutionsNumber(testSets)}}"
37+
writeToFileAndSave(executionOutput, executionReport)
38+
}
2939
}
3040
}

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,11 @@ class PythonGenerateTestsCommand : CliktCommand(
7676
help = "File to write coverage report."
7777
)
7878

79+
private val executionCounterOutput by option(
80+
"--executions-counter",
81+
help = "File to write number of executions."
82+
)
83+
7984
private val installRequirementsIfMissing by option(
8085
"--install-requirements",
8186
help = "Install Python requirements if missing."
@@ -255,6 +260,7 @@ class PythonGenerateTestsCommand : CliktCommand(
255260
output.toAbsolutePath(),
256261
logger,
257262
coverageOutput?.toAbsolutePath(),
263+
executionCounterOutput?.toAbsolutePath(),
258264
)
259265

260266
logger.info("Loading information about Python types...")
@@ -270,7 +276,8 @@ class PythonGenerateTestsCommand : CliktCommand(
270276
testSet.executions.filterNot { it.result is UtExecutionSuccess },
271277
testSet.errors,
272278
testSet.mypyReport,
273-
testSet.classId
279+
testSet.classId,
280+
testSet.executionsNumber
274281
)
275282
}
276283
}

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.4.44"
3+
version = "1.7.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.4.44
1+
1.7.0

utbot-python/samples/cli_utbot_tests/generated_tests__arithmetic.py

Lines changed: 0 additions & 40 deletions
This file was deleted.

utbot-python/samples/cli_utbot_tests/generated_tests__deep_equals.py

Lines changed: 0 additions & 87 deletions
This file was deleted.

utbot-python/samples/cli_utbot_tests/generated_tests__deque.py

Lines changed: 0 additions & 35 deletions
This file was deleted.

utbot-python/samples/cli_utbot_tests/generated_tests__dicts.py

Lines changed: 0 additions & 44 deletions
This file was deleted.

utbot-python/samples/cli_utbot_tests/generated_tests__dummy_with_eq.py

Lines changed: 0 additions & 39 deletions
This file was deleted.

utbot-python/samples/cli_utbot_tests/generated_tests__dummy_without_eq.py

Lines changed: 0 additions & 36 deletions
This file was deleted.

utbot-python/samples/cli_utbot_tests/generated_tests__graph.py

Lines changed: 0 additions & 36 deletions
This file was deleted.

0 commit comments

Comments
 (0)