mirror of
https://github.com/K-Dense-AI/scientific-agent-skills.git
synced 2026-12-04 01:24:00 +08:00
- Introduced a comprehensive test suite for the autoskill project, including tests for backends, CLI commands, and various skill functionalities. - Added smoke tests for LM Studio integration to validate real-time interactions. - Implemented tests for session clustering and event fetching to ensure accurate data handling. - Established a framework for skill description loading and matching, enhancing the robustness of skill management. - Included redaction tests to verify sensitive information is properly handled in outputs. - Created end-to-end tests to simulate the full autoskill pipeline, ensuring all components work together seamlessly.
62 lines
1.5 KiB
Python
62 lines
1.5 KiB
Python
import pytest
|
|
|
|
import autoskill
|
|
|
|
|
|
def test_dispatches_to_run_subcommand(monkeypatch):
|
|
calls = {}
|
|
|
|
def fake_run_main(argv):
|
|
calls["run"] = argv
|
|
return 0
|
|
|
|
monkeypatch.setattr("run.main", fake_run_main)
|
|
rc = autoskill.main(["run", "--start", "a", "--end", "b"])
|
|
|
|
assert rc == 0
|
|
assert calls["run"] == ["--start", "a", "--end", "b"]
|
|
|
|
|
|
def test_dispatches_to_doctor_subcommand(monkeypatch):
|
|
calls = {}
|
|
|
|
def fake_doctor_main(argv):
|
|
calls["doctor"] = argv
|
|
return 0
|
|
|
|
monkeypatch.setattr("doctor.main", fake_doctor_main)
|
|
rc = autoskill.main(["doctor", "--config", "x", "--skills-dir", "y"])
|
|
|
|
assert rc == 0
|
|
assert calls["doctor"] == ["--config", "x", "--skills-dir", "y"]
|
|
|
|
|
|
def test_dispatches_to_promote_subcommand(monkeypatch):
|
|
calls = {}
|
|
|
|
def fake_promote_main(argv):
|
|
calls["promote"] = argv
|
|
return 0
|
|
|
|
monkeypatch.setattr("promote.main", fake_promote_main)
|
|
rc = autoskill.main(["promote", "--proposed", "p", "--skills-dir", "s", "--name", "n"])
|
|
|
|
assert rc == 0
|
|
assert calls["promote"] == ["--proposed", "p", "--skills-dir", "s", "--name", "n"]
|
|
|
|
|
|
def test_propagates_nonzero_exit_code(monkeypatch):
|
|
monkeypatch.setattr("run.main", lambda argv: 7)
|
|
rc = autoskill.main(["run", "--start", "a", "--end", "b"])
|
|
assert rc == 7
|
|
|
|
|
|
def test_missing_subcommand_errors_out():
|
|
with pytest.raises(SystemExit):
|
|
autoskill.main([])
|
|
|
|
|
|
def test_unknown_subcommand_errors_out():
|
|
with pytest.raises(SystemExit):
|
|
autoskill.main(["nope"])
|