Skip to content

Commit 5c6c576

Browse files
Improving external SDK for function
1 parent 184b522 commit 5c6c576

3 files changed

Lines changed: 2 additions & 17 deletions

File tree

src/datacustomcode/cli.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,15 @@ def _generate_function_test_file(entrypoint_path: str) -> Optional[str]:
8383
Returns:
8484
Path to generated test.json, or None if generation failed
8585
"""
86-
from datacustomcode.template import generate_test_json
86+
from datacustomcode.function_utils import generate_test_json
8787

8888
tests_dir = os.path.join(os.path.dirname(entrypoint_path), "tests")
8989
os.makedirs(tests_dir, exist_ok=True)
9090
test_json_path = os.path.join(tests_dir, "test.json")
9191

9292
try:
9393
generate_test_json(entrypoint_path, test_json_path)
94+
logger.debug(f"Generated test JSON at {test_json_path}")
9495
return test_json_path
9596
except Exception as e:
9697
logger.warning(f"Could not generate test.json: {e}")

src/datacustomcode/run.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -191,11 +191,7 @@ def run_function_with_test(entrypoint: str, test_file: str) -> None:
191191
print("RESULT:")
192192
print("=" * 80)
193193
if hasattr(result, "model_dump"):
194-
# Pydantic v2
195194
print(json.dumps(result.model_dump(), indent=2))
196-
elif hasattr(result, "dict"):
197-
# Pydantic v1
198-
print(json.dumps(result.dict(), indent=2))
199195
else:
200196
print(result)
201197
print("=" * 80)

src/datacustomcode/template.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,3 @@ def copy_function_template(target_dir: str, use_in_feature: str) -> None:
6262
shutil.copy2(source, destination)
6363

6464

65-
# Re-export generate_test_json from function_utils for backwards compatibility
66-
def generate_test_json(entrypoint_path: str, output_path: str) -> None:
67-
"""Generate a sample test.json file for a function.
68-
69-
Args:
70-
entrypoint_path: Path to the function entrypoint.py
71-
output_path: Output path for test.json
72-
"""
73-
from datacustomcode.function_utils import generate_test_json as _generate_test_json
74-
75-
_generate_test_json(entrypoint_path, output_path)
76-
logger.debug(f"Generated test JSON at {output_path}")

0 commit comments

Comments
 (0)