|
|
|
|
@ -23,11 +23,8 @@ from swarms.structs import (
|
|
|
|
|
from swarms.structs.hiearchical_swarm import HierarchicalSwarm
|
|
|
|
|
from swarms.structs.tree_swarm import ForestSwarm, Tree, TreeAgent
|
|
|
|
|
|
|
|
|
|
# Load environment variables
|
|
|
|
|
load_dotenv()
|
|
|
|
|
|
|
|
|
|
API_KEY = os.getenv("OPENAI_API_KEY")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def generate_timestamp() -> str:
|
|
|
|
|
"""Generate a timestamp string for filenames"""
|
|
|
|
|
@ -82,58 +79,6 @@ def write_markdown_report(
|
|
|
|
|
f.write("---\n\n")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# def create_github_issue(test_result: Dict[str, Any]) -> Dict[str, Any]:
|
|
|
|
|
# """Create a GitHub issue for a failed test"""
|
|
|
|
|
# if not all([GITHUB_TOKEN, GITHUB_REPO_OWNER, GITHUB_REPO_NAME]):
|
|
|
|
|
# logger.warning("GitHub credentials not configured. Skipping issue creation.")
|
|
|
|
|
# return None
|
|
|
|
|
|
|
|
|
|
# if test_result["status"] != "failed":
|
|
|
|
|
# return None
|
|
|
|
|
|
|
|
|
|
# issue_title = f"Automated Test Failure: {test_result['test_name']}"
|
|
|
|
|
|
|
|
|
|
# issue_body = f"""
|
|
|
|
|
# ## Test Failure Report
|
|
|
|
|
|
|
|
|
|
# - **Test Name**: `{test_result['test_name']}`
|
|
|
|
|
# - **Timestamp**: `{datetime.now().isoformat()}`
|
|
|
|
|
# - **Status**: {test_result['status']}
|
|
|
|
|
|
|
|
|
|
# ### Error Information
|
|
|
|
|
# ```
|
|
|
|
|
# {test_result.get('error', 'No error message available')}
|
|
|
|
|
# ```
|
|
|
|
|
|
|
|
|
|
# ### Response (if available)
|
|
|
|
|
# ```json
|
|
|
|
|
# {json.dumps(test_result.get('response', {}), indent=2)}
|
|
|
|
|
# ```
|
|
|
|
|
|
|
|
|
|
# ---
|
|
|
|
|
# *This issue was automatically generated by the Swarms testing workflow.*
|
|
|
|
|
# """
|
|
|
|
|
|
|
|
|
|
# payload = {
|
|
|
|
|
# "title": issue_title,
|
|
|
|
|
# "body": issue_body,
|
|
|
|
|
# "labels": ["bug", "test-failure", "automated-report"],
|
|
|
|
|
# }
|
|
|
|
|
|
|
|
|
|
# try:
|
|
|
|
|
# response = requests.post(
|
|
|
|
|
# f"{BASE_URL}/repos/{GITHUB_REPO_OWNER}/{GITHUB_REPO_NAME}/issues",
|
|
|
|
|
# headers=GITHUB_HEADERS,
|
|
|
|
|
# json=payload,
|
|
|
|
|
# )
|
|
|
|
|
# response.raise_for_status()
|
|
|
|
|
# logger.info(f"Created GitHub issue for {test_result['test_name']}")
|
|
|
|
|
# return response.json()
|
|
|
|
|
# except requests.exceptions.RequestException as e:
|
|
|
|
|
# logger.error(f"Failed to create GitHub issue: {e.response.text if e.response else str(e)}")
|
|
|
|
|
# return None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def create_test_agent(
|
|
|
|
|
name: str,
|
|
|
|
|
system_prompt: str = None,
|
|
|
|
|
|