53 lines
1.6 KiB
Python
Executable File
53 lines
1.6 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
"""Phylogeny Skill 测试"""
|
|
|
|
import tempfile
|
|
import unittest
|
|
from pathlib import Path
|
|
|
|
import sys
|
|
sys.path.insert(0, str(Path(__file__).parent.parent))
|
|
|
|
from run import PhylogenySkill
|
|
|
|
|
|
class TestPhylogenySkill(unittest.TestCase):
|
|
|
|
def setUp(self):
|
|
self.skill = PhylogenySkill()
|
|
self.temp_dir = Path(tempfile.mkdtemp())
|
|
|
|
def tearDown(self):
|
|
import shutil
|
|
shutil.rmtree(self.temp_dir, ignore_errors=True)
|
|
|
|
def test_demo_mode(self):
|
|
"""测试Demo模式"""
|
|
result = self.skill.run_demo(self.temp_dir)
|
|
|
|
self.assertEqual(result["status"], "success")
|
|
self.assertIn("output_dir", result)
|
|
self.assertIn("report", result)
|
|
|
|
# 检查输出文件
|
|
output_dir = Path(result["output_dir"])
|
|
self.assertTrue((output_dir / "report.md").exists())
|
|
self.assertTrue((output_dir / "commands.sh").exists())
|
|
self.assertTrue((output_dir / "environment.yml").exists())
|
|
self.assertTrue((output_dir / "checksums.sha256").exists())
|
|
self.assertTrue((output_dir / "alignment.aln").exists())
|
|
self.assertTrue((output_dir / "phylogeny.tree").exists())
|
|
|
|
def test_config_loading(self):
|
|
"""测试配置加载"""
|
|
config = self.skill.config
|
|
|
|
self.assertIn("skill", config)
|
|
self.assertIn("parameters", config)
|
|
self.assertEqual(config["skill"]["name"], "phylogeny")
|
|
self.assertIn("aligner", config["parameters"])
|
|
self.assertIn("tree_builder", config["parameters"])
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main() |