testgenie-py 0.1.7__py3-none-any.whl → 0.1.9__py3-none-any.whl

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.
testgen/.coverage CHANGED
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
- docker_dir = os.path.join(project_root, "testgen", "docker")
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: {os.path.dirname(dockerfile_path)}")
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=os.path.join(project_root, "testgen", "docker"),
155
- dockerfile=os.path.join(project_root, "testgen", "docker", "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:
File without changes
@@ -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
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: testgenie-py
3
- Version: 0.1.7
3
+ Version: 0.1.9
4
4
  Summary:
5
5
  Author: cjseitz
6
6
  Author-email: charlesjseitz@gmail.com
@@ -1,4 +1,4 @@
1
- testgen/.coverage,sha256=LBC31i6ROQvL24jd3a-mAlGfailO1bmEWlrTCTbxC8s,53248
1
+ testgen/.coverage,sha256=_X1vh4t_SSQH7gwvZk6A8xGjBlVYhPYfhXwe0Z8Iahs,69632
2
2
  testgen/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
3
  testgen/analyzer/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  testgen/analyzer/ast_analyzer.py,sha256=JmqiosxgZJm2fhNDr5VUBpKKHmf8S2HP9Jm0Xl7NnnI,6783
@@ -22,7 +22,7 @@ testgen/code_to_test/no_types.py,sha256=kD8CGjVAxVeCjQC45abO773sRNIjiZ4jvhwPRV8-
22
22
  testgen/code_to_test/sample_code_bin.py,sha256=kMvV_-oFeAkxUmDx41Pw0iTTmMG1pvX31TezXPWMOkE,4225
23
23
  testgen/controller/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
24
24
  testgen/controller/cli_controller.py,sha256=jSwT6Cy3JQhxFPRXaODdZ1md5uXO83Q0IrYh86sIdiE,8832
25
- testgen/controller/docker_controller.py,sha256=Jz1Nc7LW-njvCLDk3svPCVz5UDeQ7gAEFLHXrU1Yrws,7237
25
+ testgen/controller/docker_controller.py,sha256=AF6RFhRMJS9rhE-TGpm8Df48LKCdZFhyDp6jDbukvmk,8186
26
26
  testgen/docker/Dockerfile,sha256=OLaWW4i6uUvVQinzYOmazGDAILyM8czcfl-ENkHLKQw,534
27
27
  testgen/docker/poetry.lock,sha256=3ZPF2N4KtpMRc9qfamUXumMw7qGmQHaZDaxJ9_bMo7U,51684
28
28
  testgen/docker/pyproject.toml,sha256=JWhMupWM7aQFO7-teR9sfFahKB3aM4NPO8on5P3TRxw,563
@@ -59,6 +59,8 @@ testgen/sqlite/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
59
59
  testgen/sqlite/db.py,sha256=RUt88ndT4CQRo9aZzLGXPHRK1iw0LyDEGnoWlOLzKGM,2390
60
60
  testgen/sqlite/db_service.py,sha256=i87YkhMP0VNyug5p1tWUvnzHB8isFcSIRe9vJJTmFLA,8954
61
61
  testgen/testgen.db,sha256=iyQiDqur-JoS70QD-VYkJFkgjb_YcK2jBAP2aZvvAhY,106496
62
+ testgen/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
63
+ testgen/tests/test_decisions.py,sha256=KEbmGbN8IjZsAEv_UOKzdP1a7M7x_U2IHku5XUvpRJE,4039
62
64
  testgen/tree/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
63
65
  testgen/tree/node.py,sha256=ONJtbACShN4yNj1X-UslFRgLyBP6mrbg7qZr3c6dWyA,165
64
66
  testgen/tree/tree_utils.py,sha256=gT7jucky6_GWVOlDI6jpv6RMeWCkntGOHIYLvHxD85k,2122
@@ -74,7 +76,7 @@ testgen/util/z3_utils/branch_condition.py,sha256=N9FNR-iJmxIC62NpDQNVZ1OP14rXXqY
74
76
  testgen/util/z3_utils/constraint_extractor.py,sha256=RXJLpmk6dAvHZ27839VXKXNtdy9St1F-17-pSEFu4bM,1285
75
77
  testgen/util/z3_utils/variable_finder.py,sha256=dUh3F9_L_BDMz1ybiGss09LLcM_egbitgj0FT5Nh9u4,245
76
78
  testgen/util/z3_utils/z3_test_case.py,sha256=yF4oJOrXMLzOwDUqXdoeg83MOTl3pvc_lYaZcS01CuQ,4983
77
- testgenie_py-0.1.7.dist-info/METADATA,sha256=NEqEmswegGYpbG08DuV50BxSw3yvYbXDQJdgujnH5I8,843
78
- testgenie_py-0.1.7.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
79
- testgenie_py-0.1.7.dist-info/entry_points.txt,sha256=OUN4GqB4zHlHWwWGjwIPbur4E_ZqQgkeeqaCLhzRZgg,47
80
- testgenie_py-0.1.7.dist-info/RECORD,,
79
+ testgenie_py-0.1.9.dist-info/METADATA,sha256=tr7Wa212lhnjykHl1qKbMXUy14unK_t7HN45KxgOVKg,843
80
+ testgenie_py-0.1.9.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
81
+ testgenie_py-0.1.9.dist-info/entry_points.txt,sha256=OUN4GqB4zHlHWwWGjwIPbur4E_ZqQgkeeqaCLhzRZgg,47
82
+ testgenie_py-0.1.9.dist-info/RECORD,,