From 85793ff9d508de4d9e789066ca505ac8e5003b50 Mon Sep 17 00:00:00 2001 From: gooker_young Date: Sat, 4 Jul 2026 10:22:35 +0800 Subject: [PATCH] =?UTF-8?q?test(cli):=20=E4=B8=BA=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=86=99=E5=85=A5=E9=94=99=E8=AF=AF=E6=B5=8B=E8=AF=95=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0root=E6=9D=83=E9=99=90=E8=B7=B3=E8=BF=87=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/cli/test_bumpversion.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/cli/test_bumpversion.py b/tests/cli/test_bumpversion.py index c886cd2..b40cbdd 100644 --- a/tests/cli/test_bumpversion.py +++ b/tests/cli/test_bumpversion.py @@ -2,6 +2,7 @@ from __future__ import annotations +import os from pathlib import Path from unittest.mock import patch @@ -161,6 +162,9 @@ dependencies = ["lib >= 2.0.0", "other >= 3.0.0"] def test_file_write_error(self, tmp_path: Path, capsys: pytest.CaptureFixture[str]) -> None: """Should handle file write errors.""" + if os.geteuid() == 0: + pytest.skip("测试在 root 权限下不适用") + # 在只读目录中创建文件(这个测试在某些系统上可能不适用) test_file = tmp_path / "readonly.toml" test_file.write_text('version = "1.0.0"', encoding="utf-8")