d4a1a5c2de
1. 替换所有旧的main函数测试逻辑,统一使用pyflowx的CliRunner和run方法进行测试 2. 重构测试类命名,将零散测试合并为TaskSpec验证测试 3. 优化测试用例结构,移除冗余的pytest依赖导入和旧版测试代码 4. 更新文件夹备份、压缩等模块的测试逻辑,适配新的工具函数实现
39 lines
1.3 KiB
Python
39 lines
1.3 KiB
Python
"""Tests for cli.envqt module."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from unittest.mock import patch
|
|
|
|
import pyflowx as px
|
|
from pyflowx.cli import envqt
|
|
|
|
|
|
# ---------------------------------------------------------------------- #
|
|
# TaskSpec definitions
|
|
# ---------------------------------------------------------------------- #
|
|
class TestTaskSpecDefinitions:
|
|
"""Test that all TaskSpec definitions are valid."""
|
|
|
|
def test_envqt_install_spec(self) -> None:
|
|
"""envqt_install spec should be properly defined."""
|
|
assert envqt.envqt_install.name == "envqt_install"
|
|
assert envqt.envqt_install.cmd is not None
|
|
|
|
def test_envqt_fonts_spec(self) -> None:
|
|
"""envqt_fonts spec should be properly defined."""
|
|
assert envqt.envqt_fonts.name == "envqt_fonts"
|
|
assert envqt.envqt_fonts.cmd is not None
|
|
|
|
|
|
# ---------------------------------------------------------------------- #
|
|
# main function
|
|
# ---------------------------------------------------------------------- #
|
|
class TestMain:
|
|
"""Test main function."""
|
|
|
|
def test_main_calls_run_cli(self) -> None:
|
|
"""main() should create a CliRunner and call run_cli()."""
|
|
with patch.object(px.CliRunner, "run_cli") as mock_run_cli:
|
|
envqt.main()
|
|
assert mock_run_cli.called
|