Skip to content

Commit 33656e9

Browse files
committed
test: add entry points validation
1 parent 2225136 commit 33656e9

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

tests/test_jmcomic/test_jm_cli.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,23 @@ def test_jmcomic_download_album(self):
4343

4444
# ========== jmv 命令测试 ==========
4545

46+
def test_entry_points_installed(self):
47+
"""验证控制台命令行是否被正确安装到了所在系统的环境变量里"""
48+
import shutil
49+
import subprocess
50+
for cmd in ['jmcomic', 'jmv']:
51+
self.assertIsNotNone(
52+
shutil.which(cmd),
53+
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."
54+
)
55+
56+
try:
57+
subprocess.run([cmd, "--help"], capture_output=True, text=True, check=True)
58+
except subprocess.CalledProcessError as e:
59+
self.fail(f"Command '{cmd} --help' failed with exit code {e.returncode}. Stderr: {e.stderr.strip()}")
60+
except Exception as e:
61+
self.fail(f"Failed to execute command '{cmd}': {e}")
62+
4663
# -- extract_album_id --
4764

4865
def test_jmv_extract_pure_digits(self):

0 commit comments

Comments
 (0)