[HLCC-ICE-000001][ZY-CONTRIB-20260723-001] feat: 以来光者贡献链启用冰朔第五域个人子频道
This commit is contained in:
commit
5615453e4e
660 changed files with 122355 additions and 0 deletions
36
zero-point/core-channel/revive-guard/pre-push-clean.test.py
Normal file
36
zero-point/core-channel/revive-guard/pre-push-clean.test.py
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
import importlib.util
|
||||
import io
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
import unittest
|
||||
|
||||
PATH = os.path.join(os.path.dirname(__file__), "pre-push-clean.py")
|
||||
SPEC = importlib.util.spec_from_file_location("pre_push_clean", PATH)
|
||||
MOD = importlib.util.module_from_spec(SPEC); SPEC.loader.exec_module(MOD)
|
||||
|
||||
|
||||
class PrePushUnicodePathTests(unittest.TestCase):
|
||||
def test_fallback_file_list_preserves_unicode_paths(self):
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
old_cwd, old_stdin = os.getcwd(), sys.stdin
|
||||
try:
|
||||
os.chdir(directory)
|
||||
subprocess.run(["git", "init", "-q"], check=True)
|
||||
subprocess.run(["git", "config", "user.email", "test@example.invalid"], check=True)
|
||||
subprocess.run(["git", "config", "user.name", "test"], check=True)
|
||||
os.makedirs("霜砚", exist_ok=True)
|
||||
with open("霜砚/凭证.md", "w", encoding="utf-8") as handle:
|
||||
handle.write("safe\n")
|
||||
subprocess.run(["git", "add", "."], check=True)
|
||||
subprocess.run(["git", "commit", "-qm", "fixture"], check=True)
|
||||
sys.stdin = io.StringIO("")
|
||||
self.assertIn("霜砚/凭证.md", MOD.get_changed_files())
|
||||
finally:
|
||||
sys.stdin = old_stdin
|
||||
os.chdir(old_cwd)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Loading…
Reference in a new issue