Delete test_generator.py
This commit is contained in:
parent
eb16868469
commit
ba9263a779
@ -1,62 +0,0 @@
|
||||
import os
|
||||
import filecmp
|
||||
import unittest
|
||||
|
||||
|
||||
class TestWorkflowGeneration(unittest.TestCase):
|
||||
"""
|
||||
Unit tests for verifying workflow generation.
|
||||
"""
|
||||
|
||||
def setUp(self):
|
||||
# Ensure required directories exist
|
||||
self.output_dir = "generated_workflows"
|
||||
if not os.path.exists(self.output_dir):
|
||||
os.makedirs(self.output_dir)
|
||||
|
||||
# Set required environment variables
|
||||
os.environ["REPO_NAME"] = "test_repo"
|
||||
os.environ["BRANCH_NAME"] = "test_branch"
|
||||
os.environ["VERSION"] = "1234567890"
|
||||
os.environ["NAMESPACE"] = "test_namespace"
|
||||
|
||||
def run_test_case(self, flow_file, expected_output):
|
||||
"""
|
||||
Helper function to run a test case.
|
||||
|
||||
Args:
|
||||
flow_file (str): The input flow definition JSON file.
|
||||
expected_output (str): The path to the expected output file.
|
||||
"""
|
||||
output_file = os.path.join(self.output_dir, "workflow.py")
|
||||
|
||||
# Run the generator with the specified flow file and output file
|
||||
os.system(f"python generator.py --input-file {flow_file} --output-file {output_file}")
|
||||
|
||||
# Compare the generated file with the expected output
|
||||
self.assertTrue(
|
||||
os.path.exists(output_file), f"Generated file not found: {output_file}"
|
||||
)
|
||||
self.assertTrue(
|
||||
filecmp.cmp(output_file, expected_output, shallow=False),
|
||||
f"Generated file {output_file} does not match expected output {expected_output}",
|
||||
)
|
||||
|
||||
def test_sequential_flow(self):
|
||||
self.run_test_case(
|
||||
"sample_flows/flow_sequential.json", "expected_workflows/flow_sequential_expected.py"
|
||||
)
|
||||
|
||||
def test_parallel_flow(self):
|
||||
self.run_test_case(
|
||||
"sample_flows/flow_parallel.json", "expected_workflows/flow_parallel_expected.py"
|
||||
)
|
||||
|
||||
def test_hybrid_flow(self):
|
||||
self.run_test_case(
|
||||
"sample_flows/flow_hybrid.json", "expected_workflows/flow_hybrid_expected.py"
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Loading…
x
Reference in New Issue
Block a user