diff --git a/pyproject.toml b/pyproject.toml index 96671104..e7387498 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,6 +38,7 @@ Documentation = "https://jmcomic.readthedocs.io" [project.scripts] jmcomic = "jmcomic.cl:main" +jmv = "jmcomic.cl:view_main" [tool.setuptools.dynamic] version = {attr = "jmcomic.__version__"} \ No newline at end of file diff --git a/src/jmcomic/__init__.py b/src/jmcomic/__init__.py index a052b094..9698ba5f 100644 --- a/src/jmcomic/__init__.py +++ b/src/jmcomic/__init__.py @@ -2,7 +2,7 @@ # 被依赖方 <--- 使用方 # config <--- entity <--- toolkit <--- client <--- option <--- downloader -__version__ = '2.6.17' +__version__ = '2.6.18' from .api import * from .jm_plugin import * diff --git a/tests/test_jmcomic/test_jm_cli.py b/tests/test_jmcomic/test_jm_cli.py index 8c2a6b7a..3db1b237 100644 --- a/tests/test_jmcomic/test_jm_cli.py +++ b/tests/test_jmcomic/test_jm_cli.py @@ -43,6 +43,31 @@ def test_jmcomic_download_album(self): # ========== jmv 命令测试 ========== + def test_entry_points_installed(self): + """验证控制台命令行是否被正确安装到了所在系统的环境变量里""" + import shutil + import subprocess + for cmd in ['jmcomic', 'jmv']: + self.assertIsNotNone( + shutil.which(cmd), + f"Command '{cmd}' not found in PATH. Please verify entry_points in setup.py or [project.scripts] in pyproject.toml and ensure the package is installed." + ) + + try: + subprocess.run( + [cmd, "--help"], + capture_output=True, + text=True, + check=True, + timeout=10, + ) + except subprocess.TimeoutExpired: + self.fail(f"Command '{cmd} --help' timed out execution.") + except subprocess.CalledProcessError as e: + self.fail(f"Command '{cmd} --help' failed with exit code {e.returncode}. Stderr: {e.stderr.strip()}") + except OSError as e: + self.fail(f"Failed to execute command '{cmd}': {e}") + # -- extract_album_id -- def test_jmv_extract_pure_digits(self):