testgenie-py 0.1.7__tar.gz → 0.1.9__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {testgenie_py-0.1.7 → testgenie_py-0.1.9}/PKG-INFO +1 -1
- {testgenie_py-0.1.7 → testgenie_py-0.1.9}/pyproject.toml +2 -1
- {testgenie_py-0.1.7 → testgenie_py-0.1.9}/testgen/.coverage +0 -0
- {testgenie_py-0.1.7 → testgenie_py-0.1.9}/testgen/controller/docker_controller.py +30 -5
- testgenie_py-0.1.9/testgen/tests/test_decisions.py +177 -0
- testgenie_py-0.1.9/testgen/util/z3_utils/__init__.py +0 -0
- {testgenie_py-0.1.7 → testgenie_py-0.1.9}/README.md +0 -0
- {testgenie_py-0.1.7 → testgenie_py-0.1.9}/testgen/__init__.py +0 -0
- {testgenie_py-0.1.7 → testgenie_py-0.1.9}/testgen/analyzer/__init__.py +0 -0
- {testgenie_py-0.1.7 → testgenie_py-0.1.9}/testgen/analyzer/ast_analyzer.py +0 -0
- {testgenie_py-0.1.7 → testgenie_py-0.1.9}/testgen/analyzer/contracts/__init__.py +0 -0
- {testgenie_py-0.1.7 → testgenie_py-0.1.9}/testgen/analyzer/contracts/contract.py +0 -0
- {testgenie_py-0.1.7 → testgenie_py-0.1.9}/testgen/analyzer/contracts/no_exception_contract.py +0 -0
- {testgenie_py-0.1.7 → testgenie_py-0.1.9}/testgen/analyzer/contracts/nonnull_contract.py +0 -0
- {testgenie_py-0.1.7 → testgenie_py-0.1.9}/testgen/analyzer/fuzz_analyzer.py +0 -0
- {testgenie_py-0.1.7 → testgenie_py-0.1.9}/testgen/analyzer/random_feedback_analyzer.py +0 -0
- {testgenie_py-0.1.7 → testgenie_py-0.1.9}/testgen/analyzer/reinforcement_analyzer.py +0 -0
- {testgenie_py-0.1.7 → testgenie_py-0.1.9}/testgen/analyzer/test_case_analyzer.py +0 -0
- {testgenie_py-0.1.7 → testgenie_py-0.1.9}/testgen/analyzer/test_case_analyzer_context.py +0 -0
- {testgenie_py-0.1.7 → testgenie_py-0.1.9}/testgen/code_to_test/__init__.py +0 -0
- {testgenie_py-0.1.7 → testgenie_py-0.1.9}/testgen/code_to_test/boolean.py +0 -0
- {testgenie_py-0.1.7 → testgenie_py-0.1.9}/testgen/code_to_test/calculator.py +0 -0
- {testgenie_py-0.1.7 → testgenie_py-0.1.9}/testgen/code_to_test/code_to_fuzz.py +0 -0
- {testgenie_py-0.1.7 → testgenie_py-0.1.9}/testgen/code_to_test/code_to_fuzz_lite.py +0 -0
- {testgenie_py-0.1.7 → testgenie_py-0.1.9}/testgen/code_to_test/decisions.py +0 -0
- {testgenie_py-0.1.7 → testgenie_py-0.1.9}/testgen/code_to_test/math_utils.py +0 -0
- {testgenie_py-0.1.7 → testgenie_py-0.1.9}/testgen/code_to_test/no_types.py +0 -0
- {testgenie_py-0.1.7 → testgenie_py-0.1.9}/testgen/code_to_test/sample_code_bin.py +0 -0
- {testgenie_py-0.1.7 → testgenie_py-0.1.9}/testgen/controller/__init__.py +0 -0
- {testgenie_py-0.1.7 → testgenie_py-0.1.9}/testgen/controller/cli_controller.py +0 -0
- {testgenie_py-0.1.7 → testgenie_py-0.1.9}/testgen/docker/Dockerfile +0 -0
- {testgenie_py-0.1.7 → testgenie_py-0.1.9}/testgen/docker/poetry.lock +0 -0
- {testgenie_py-0.1.7 → testgenie_py-0.1.9}/testgen/docker/pyproject.toml +0 -0
- {testgenie_py-0.1.7 → testgenie_py-0.1.9}/testgen/generator/__init__.py +0 -0
- {testgenie_py-0.1.7 → testgenie_py-0.1.9}/testgen/generator/code_generator.py +0 -0
- {testgenie_py-0.1.7 → testgenie_py-0.1.9}/testgen/generator/doctest_generator.py +0 -0
- {testgenie_py-0.1.7 → testgenie_py-0.1.9}/testgen/generator/generator.py +0 -0
- {testgenie_py-0.1.7 → testgenie_py-0.1.9}/testgen/generator/pytest_generator.py +0 -0
- {testgenie_py-0.1.7 → testgenie_py-0.1.9}/testgen/generator/test_generator.py +0 -0
- {testgenie_py-0.1.7 → testgenie_py-0.1.9}/testgen/generator/unit_test_generator.py +0 -0
- {testgenie_py-0.1.7 → testgenie_py-0.1.9}/testgen/inspector/__init__.py +0 -0
- {testgenie_py-0.1.7 → testgenie_py-0.1.9}/testgen/inspector/inspector.py +0 -0
- {testgenie_py-0.1.7 → testgenie_py-0.1.9}/testgen/main.py +0 -0
- {testgenie_py-0.1.7 → testgenie_py-0.1.9}/testgen/models/__init__.py +0 -0
- {testgenie_py-0.1.7 → testgenie_py-0.1.9}/testgen/models/analysis_context.py +0 -0
- {testgenie_py-0.1.7 → testgenie_py-0.1.9}/testgen/models/function_metadata.py +0 -0
- {testgenie_py-0.1.7 → testgenie_py-0.1.9}/testgen/models/generator_context.py +0 -0
- {testgenie_py-0.1.7 → testgenie_py-0.1.9}/testgen/models/test_case.py +0 -0
- {testgenie_py-0.1.7 → testgenie_py-0.1.9}/testgen/presentation/__init__.py +0 -0
- {testgenie_py-0.1.7 → testgenie_py-0.1.9}/testgen/presentation/cli_view.py +0 -0
- {testgenie_py-0.1.7 → testgenie_py-0.1.9}/testgen/q_table/global_q_table.json +0 -0
- {testgenie_py-0.1.7 → testgenie_py-0.1.9}/testgen/reinforcement/__init__.py +0 -0
- {testgenie_py-0.1.7 → testgenie_py-0.1.9}/testgen/reinforcement/abstract_state.py +0 -0
- {testgenie_py-0.1.7 → testgenie_py-0.1.9}/testgen/reinforcement/agent.py +0 -0
- {testgenie_py-0.1.7 → testgenie_py-0.1.9}/testgen/reinforcement/environment.py +0 -0
- {testgenie_py-0.1.7 → testgenie_py-0.1.9}/testgen/reinforcement/statement_coverage_state.py +0 -0
- {testgenie_py-0.1.7 → testgenie_py-0.1.9}/testgen/service/__init__.py +0 -0
- {testgenie_py-0.1.7 → testgenie_py-0.1.9}/testgen/service/analysis_service.py +0 -0
- {testgenie_py-0.1.7 → testgenie_py-0.1.9}/testgen/service/cfg_service.py +0 -0
- {testgenie_py-0.1.7 → testgenie_py-0.1.9}/testgen/service/generator_service.py +0 -0
- {testgenie_py-0.1.7 → testgenie_py-0.1.9}/testgen/service/logging_service.py +0 -0
- {testgenie_py-0.1.7 → testgenie_py-0.1.9}/testgen/service/service.py +0 -0
- {testgenie_py-0.1.7 → testgenie_py-0.1.9}/testgen/sqlite/__init__.py +0 -0
- {testgenie_py-0.1.7 → testgenie_py-0.1.9}/testgen/sqlite/db.py +0 -0
- {testgenie_py-0.1.7 → testgenie_py-0.1.9}/testgen/sqlite/db_service.py +0 -0
- {testgenie_py-0.1.7 → testgenie_py-0.1.9}/testgen/testgen.db +0 -0
- {testgenie_py-0.1.7/testgen/tree → testgenie_py-0.1.9/testgen/tests}/__init__.py +0 -0
- {testgenie_py-0.1.7/testgen/util → testgenie_py-0.1.9/testgen/tree}/__init__.py +0 -0
- {testgenie_py-0.1.7 → testgenie_py-0.1.9}/testgen/tree/node.py +0 -0
- {testgenie_py-0.1.7 → testgenie_py-0.1.9}/testgen/tree/tree_utils.py +0 -0
- {testgenie_py-0.1.7/testgen/util/z3_utils → testgenie_py-0.1.9/testgen/util}/__init__.py +0 -0
- {testgenie_py-0.1.7 → testgenie_py-0.1.9}/testgen/util/coverage_utils.py +0 -0
- {testgenie_py-0.1.7 → testgenie_py-0.1.9}/testgen/util/coverage_visualizer.py +0 -0
- {testgenie_py-0.1.7 → testgenie_py-0.1.9}/testgen/util/file_utils.py +0 -0
- {testgenie_py-0.1.7 → testgenie_py-0.1.9}/testgen/util/randomizer.py +0 -0
- {testgenie_py-0.1.7 → testgenie_py-0.1.9}/testgen/util/utils.py +0 -0
- {testgenie_py-0.1.7 → testgenie_py-0.1.9}/testgen/util/z3_utils/ast_to_z3.py +0 -0
- {testgenie_py-0.1.7 → testgenie_py-0.1.9}/testgen/util/z3_utils/branch_condition.py +0 -0
- {testgenie_py-0.1.7 → testgenie_py-0.1.9}/testgen/util/z3_utils/constraint_extractor.py +0 -0
- {testgenie_py-0.1.7 → testgenie_py-0.1.9}/testgen/util/z3_utils/variable_finder.py +0 -0
- {testgenie_py-0.1.7 → testgenie_py-0.1.9}/testgen/util/z3_utils/z3_test_case.py +0 -0
Binary file
|
@@ -5,6 +5,9 @@ import docker
|
|
5
5
|
from docker import DockerClient, client
|
6
6
|
from docker import errors
|
7
7
|
from docker.models.containers import Container
|
8
|
+
import importlib.resources as pkg_resources
|
9
|
+
import tempfile
|
10
|
+
import shutil
|
8
11
|
|
9
12
|
from testgen.service.logging_service import get_logger
|
10
13
|
from testgen.service.service import Service
|
@@ -99,8 +102,7 @@ class DockerController:
|
|
99
102
|
print(f"Building {image_name} Docker image...")
|
100
103
|
|
101
104
|
# Look for Dockerfile in the project root
|
102
|
-
|
103
|
-
dockerfile_path = os.path.join(docker_dir, "Dockerfile")
|
105
|
+
dockerfile_path = self.get_dockerfile_path()
|
104
106
|
if not os.path.exists(dockerfile_path):
|
105
107
|
print(f"Dockerfile not found at {dockerfile_path}")
|
106
108
|
sys.exit(1)
|
@@ -146,13 +148,17 @@ class DockerController:
|
|
146
148
|
def build_docker_image(self, docker_client, image_name, dockerfile_path, project_root):
|
147
149
|
try:
|
148
150
|
print(f"Starting Docker build for image: {image_name}")
|
151
|
+
dockerfile_rel_path = os.path.relpath(dockerfile_path, project_root)
|
152
|
+
docker_dir = os.path.dirname(dockerfile_path)
|
153
|
+
|
149
154
|
dockerfile_rel_path = os.path.relpath(dockerfile_path, project_root)
|
150
155
|
self.debug(f"Project root {project_root}")
|
151
|
-
self.debug(f"Docker directory: {
|
156
|
+
self.debug(f"Docker directory: {docker_dir}")
|
152
157
|
self.debug(f"Docker rel path: {dockerfile_rel_path}")
|
158
|
+
|
153
159
|
build_progress = docker_client.api.build(
|
154
|
-
path=
|
155
|
-
dockerfile=
|
160
|
+
path=docker_dir, # now it knows what docker_dir is
|
161
|
+
dockerfile=dockerfile_path,
|
156
162
|
tag=image_name,
|
157
163
|
rm=True,
|
158
164
|
decode=True
|
@@ -178,6 +184,25 @@ class DockerController:
|
|
178
184
|
print(f"Unexpected error during Docker build: {str(e)}")
|
179
185
|
return False
|
180
186
|
|
187
|
+
def get_dockerfile_path(self) -> str:
|
188
|
+
# First, try local development path
|
189
|
+
local_dockerfile = os.path.join(os.path.dirname(__file__), "docker", "Dockerfile")
|
190
|
+
if os.path.exists(local_dockerfile):
|
191
|
+
self.debug(f"Found local Dockerfile at: {local_dockerfile}")
|
192
|
+
return local_dockerfile
|
193
|
+
|
194
|
+
# If not found locally, try inside installed package
|
195
|
+
try:
|
196
|
+
dockerfile_resource = pkg_resources.files('testgen').joinpath('docker/Dockerfile')
|
197
|
+
if dockerfile_resource.is_file():
|
198
|
+
self.debug(f"Found package-installed Dockerfile at: {dockerfile_resource}")
|
199
|
+
return str(dockerfile_resource)
|
200
|
+
except Exception as e:
|
201
|
+
print(f"Error locating Dockerfile in package resources: {e}")
|
202
|
+
|
203
|
+
print("Dockerfile not found in local project or package.")
|
204
|
+
sys.exit(1)
|
205
|
+
|
181
206
|
def debug(self, message: str):
|
182
207
|
"""Log debug message"""
|
183
208
|
if self.debug_mode:
|
@@ -0,0 +1,177 @@
|
|
1
|
+
import pytest
|
2
|
+
|
3
|
+
import testgen.code_to_test.decisions as decisions
|
4
|
+
|
5
|
+
def test_add_or_subtract_0():
|
6
|
+
args = (42, 74)
|
7
|
+
expected = 116
|
8
|
+
result = decisions.add_or_subtract(*args)
|
9
|
+
assert result == expected
|
10
|
+
|
11
|
+
def test_add_or_subtract_1():
|
12
|
+
args = (11, 67)
|
13
|
+
expected = 78
|
14
|
+
result = decisions.add_or_subtract(*args)
|
15
|
+
assert result == expected
|
16
|
+
|
17
|
+
def test_add_or_subtract_2():
|
18
|
+
args = (74, 73)
|
19
|
+
expected = 1
|
20
|
+
result = decisions.add_or_subtract(*args)
|
21
|
+
assert result == expected
|
22
|
+
|
23
|
+
def test_add_or_subtract_3():
|
24
|
+
args = (93, 39)
|
25
|
+
expected = 54
|
26
|
+
result = decisions.add_or_subtract(*args)
|
27
|
+
assert result == expected
|
28
|
+
|
29
|
+
def test_add_or_subtract_4():
|
30
|
+
args = (61, 77)
|
31
|
+
expected = 138
|
32
|
+
result = decisions.add_or_subtract(*args)
|
33
|
+
assert result == expected
|
34
|
+
|
35
|
+
def test_add_or_subtract_5():
|
36
|
+
args = (73, 6)
|
37
|
+
expected = 67
|
38
|
+
result = decisions.add_or_subtract(*args)
|
39
|
+
assert result == expected
|
40
|
+
|
41
|
+
def test_add_or_subtract_6():
|
42
|
+
args = (62, 37)
|
43
|
+
expected = 25
|
44
|
+
result = decisions.add_or_subtract(*args)
|
45
|
+
assert result == expected
|
46
|
+
|
47
|
+
def test_add_or_subtract_7():
|
48
|
+
args = (42, 52)
|
49
|
+
expected = 94
|
50
|
+
result = decisions.add_or_subtract(*args)
|
51
|
+
assert result == expected
|
52
|
+
|
53
|
+
def test_add_or_subtract_8():
|
54
|
+
args = (87, 32)
|
55
|
+
expected = 55
|
56
|
+
result = decisions.add_or_subtract(*args)
|
57
|
+
assert result == expected
|
58
|
+
|
59
|
+
def test_add_or_subtract_9():
|
60
|
+
args = (93, 31)
|
61
|
+
expected = 62
|
62
|
+
result = decisions.add_or_subtract(*args)
|
63
|
+
assert result == expected
|
64
|
+
|
65
|
+
def test_add_or_subtract_10():
|
66
|
+
args = (53, 42)
|
67
|
+
expected = 11
|
68
|
+
result = decisions.add_or_subtract(*args)
|
69
|
+
assert result == expected
|
70
|
+
|
71
|
+
def test_add_or_subtract_11():
|
72
|
+
args = (58, 22)
|
73
|
+
expected = 36
|
74
|
+
result = decisions.add_or_subtract(*args)
|
75
|
+
assert result == expected
|
76
|
+
|
77
|
+
def test_add_or_subtract_12():
|
78
|
+
args = (64, 41)
|
79
|
+
expected = 23
|
80
|
+
result = decisions.add_or_subtract(*args)
|
81
|
+
assert result == expected
|
82
|
+
|
83
|
+
def test_add_or_subtract_13():
|
84
|
+
args = (76, 13)
|
85
|
+
expected = 63
|
86
|
+
result = decisions.add_or_subtract(*args)
|
87
|
+
assert result == expected
|
88
|
+
|
89
|
+
def test_add_or_subtract_14():
|
90
|
+
args = (93, 9)
|
91
|
+
expected = 84
|
92
|
+
result = decisions.add_or_subtract(*args)
|
93
|
+
assert result == expected
|
94
|
+
|
95
|
+
def test_add_or_subtract_15():
|
96
|
+
args = (65, 82)
|
97
|
+
expected = 147
|
98
|
+
result = decisions.add_or_subtract(*args)
|
99
|
+
assert result == expected
|
100
|
+
|
101
|
+
def test_email_type_16():
|
102
|
+
args = 'abc'
|
103
|
+
expected = 'invalid'
|
104
|
+
result = decisions.email_type(args)
|
105
|
+
assert result == expected
|
106
|
+
|
107
|
+
def test_http_code_17():
|
108
|
+
args = 66
|
109
|
+
expected = 'invalid'
|
110
|
+
result = decisions.http_code(args)
|
111
|
+
assert result == expected
|
112
|
+
|
113
|
+
def test_http_code_18():
|
114
|
+
args = 58
|
115
|
+
expected = 'invalid'
|
116
|
+
result = decisions.http_code(args)
|
117
|
+
assert result == expected
|
118
|
+
|
119
|
+
def test_http_code_19():
|
120
|
+
args = 26
|
121
|
+
expected = 'invalid'
|
122
|
+
result = decisions.http_code(args)
|
123
|
+
assert result == expected
|
124
|
+
|
125
|
+
def test_http_code_20():
|
126
|
+
args = 44
|
127
|
+
expected = 'invalid'
|
128
|
+
result = decisions.http_code(args)
|
129
|
+
assert result == expected
|
130
|
+
|
131
|
+
def test_http_code_21():
|
132
|
+
args = 41
|
133
|
+
expected = 'invalid'
|
134
|
+
result = decisions.http_code(args)
|
135
|
+
assert result == expected
|
136
|
+
|
137
|
+
def test_http_code_22():
|
138
|
+
args = 13
|
139
|
+
expected = 'invalid'
|
140
|
+
result = decisions.http_code(args)
|
141
|
+
assert result == expected
|
142
|
+
|
143
|
+
def test_http_code_23():
|
144
|
+
args = 32
|
145
|
+
expected = 'invalid'
|
146
|
+
result = decisions.http_code(args)
|
147
|
+
assert result == expected
|
148
|
+
|
149
|
+
def test_http_code_24():
|
150
|
+
args = 34
|
151
|
+
expected = 'invalid'
|
152
|
+
result = decisions.http_code(args)
|
153
|
+
assert result == expected
|
154
|
+
|
155
|
+
def test_http_code_25():
|
156
|
+
args = 12
|
157
|
+
expected = 'invalid'
|
158
|
+
result = decisions.http_code(args)
|
159
|
+
assert result == expected
|
160
|
+
|
161
|
+
def test_http_code_26():
|
162
|
+
args = 91
|
163
|
+
expected = 'invalid'
|
164
|
+
result = decisions.http_code(args)
|
165
|
+
assert result == expected
|
166
|
+
|
167
|
+
def test_http_code_27():
|
168
|
+
args = 22
|
169
|
+
expected = 'invalid'
|
170
|
+
result = decisions.http_code(args)
|
171
|
+
assert result == expected
|
172
|
+
|
173
|
+
def test_password_strength_28():
|
174
|
+
args = 'abc'
|
175
|
+
expected = 'weak'
|
176
|
+
result = decisions.password_strength(args)
|
177
|
+
assert result == expected
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{testgenie_py-0.1.7 → testgenie_py-0.1.9}/testgen/analyzer/contracts/no_exception_contract.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|