2024-09-20 20:49:44 +08:00
|
|
|
import unittest
|
|
|
|
|
from pathlib import Path
|
|
|
|
|
|
|
|
|
|
from rich import print
|
|
|
|
|
|
|
|
|
|
from rdagent.app.kaggle.conf import KAGGLE_IMPLEMENT_SETTING
|
|
|
|
|
from rdagent.scenarios.kaggle.experiment.workspace import KGFBWorkspace
|
2024-11-15 16:47:44 +08:00
|
|
|
from rdagent.scenarios.kaggle.kaggle_crawler import download_data
|
2024-09-20 20:49:44 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
class TestTpl(unittest.TestCase):
|
|
|
|
|
def test_competition_template(self):
|
2024-09-23 13:33:46 +08:00
|
|
|
"""
|
|
|
|
|
export KG_COMPETITION=<competition_name> before running this test
|
|
|
|
|
"""
|
2024-09-20 20:49:44 +08:00
|
|
|
competition = KAGGLE_IMPLEMENT_SETTING.competition
|
|
|
|
|
print(f"[bold orange]{competition}[/bold orange]")
|
2025-06-18 14:35:45 +08:00
|
|
|
download_data(competition, settings=KAGGLE_IMPLEMENT_SETTING)
|
2024-09-20 20:49:44 +08:00
|
|
|
ws = KGFBWorkspace(
|
|
|
|
|
template_folder_path=Path(__file__).parent.parent.parent
|
2024-11-20 17:01:18 +08:00
|
|
|
/ KAGGLE_IMPLEMENT_SETTING.template_path
|
|
|
|
|
/ f"{competition}",
|
2024-09-20 20:49:44 +08:00
|
|
|
)
|
|
|
|
|
print(ws.workspace_path)
|
|
|
|
|
ws.execute()
|
|
|
|
|
success = (ws.workspace_path / "submission.csv").exists()
|
2024-09-23 13:33:46 +08:00
|
|
|
self.assertTrue(success, "submission.csv is not generated")
|
2024-09-28 01:32:35 +08:00
|
|
|
# ws.clear()
|
2024-09-20 20:49:44 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
|
unittest.main()
|