Merge pull request #1 from openqj/chore/gitignore-state-backups
Ignore host-state backup files
This commit is contained in:
2 files changed
+10
-5
No files matched your search
@@ -10,3 +10,4 @@ __pycache__/
|
|||||||
*.tmp.*
|
*.tmp.*
|
||||||
host-config.json
|
host-config.json
|
||||||
host-config-real.json
|
host-config-real.json
|
||||||
|
host-state-real.json.bak*
|
||||||
+9
-5
@@ -1,5 +1,6 @@
|
|||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
@@ -93,7 +94,7 @@ class MergeVerifyTest(unittest.TestCase):
|
|||||||
" self.assertEqual(f(), 1)\n")
|
" self.assertEqual(f(), 1)\n")
|
||||||
(tests_dir / "test_mod.py").write_text(body, encoding="utf-8")
|
(tests_dir / "test_mod.py").write_text(body, encoding="utf-8")
|
||||||
subprocess.run(["git", "add", "-A"], cwd=tmp, check=True)
|
subprocess.run(["git", "add", "-A"], cwd=tmp, check=True)
|
||||||
subprocess.run(["git", "commit", "-qm", "initial"], cwd=tmp,
|
subprocess.run(["git", "-c", "user.name=Test", "-c", "user.email=test@example.com", "commit", "-qm", "initial"], cwd=tmp,
|
||||||
check=True)
|
check=True)
|
||||||
# worktree 手动建:模拟 host 的 worktree/分支
|
# worktree 手动建:模拟 host 的 worktree/分支
|
||||||
subprocess.run(["git", "worktree", "add", os.path.join(tmp, "wt"),
|
subprocess.run(["git", "worktree", "add", os.path.join(tmp, "wt"),
|
||||||
@@ -142,7 +143,7 @@ class MergeVerifyTest(unittest.TestCase):
|
|||||||
Path(tmp, "mod.py").write_text("def f():\n return 1\n",
|
Path(tmp, "mod.py").write_text("def f():\n return 1\n",
|
||||||
encoding="utf-8")
|
encoding="utf-8")
|
||||||
subprocess.run(["git", "add", "-A"], cwd=tmp, check=True)
|
subprocess.run(["git", "add", "-A"], cwd=tmp, check=True)
|
||||||
subprocess.run(["git", "commit", "-qm", "initial"], cwd=tmp,
|
subprocess.run(["git", "-c", "user.name=Test", "-c", "user.email=test@example.com", "commit", "-qm", "initial"], cwd=tmp,
|
||||||
check=True)
|
check=True)
|
||||||
# 分支1:加 add2
|
# 分支1:加 add2
|
||||||
subprocess.run(["git", "worktree", "add",
|
subprocess.run(["git", "worktree", "add",
|
||||||
@@ -273,9 +274,12 @@ class StateVersionTest(unittest.TestCase):
|
|||||||
|
|
||||||
|
|
||||||
class ServerRestartTest(unittest.TestCase):
|
class ServerRestartTest(unittest.TestCase):
|
||||||
|
@unittest.skipUnless(shutil.which("codex"),
|
||||||
|
"codex binary not on PATH (e.g. GitHub runner)")
|
||||||
def test_kill_then_ensure_alive(self):
|
def test_kill_then_ensure_alive(self):
|
||||||
# 不跑模型:只验证 server 进程死了能重拉、list 能通。
|
# 不跑模型:只验证 server 进程死了能重拉、list 能通。
|
||||||
# 用配对二进制(VM 本机补丁),隔离 CODEX_HOME。
|
# 用配对二进制(VM 本机补丁),隔离 CODEX_HOME。
|
||||||
|
# Runner 上没有 codex 二进制时跳过,而不是失败。
|
||||||
import host as host_mod
|
import host as host_mod
|
||||||
with tempfile.TemporaryDirectory() as tmp:
|
with tempfile.TemporaryDirectory() as tmp:
|
||||||
codex_home = os.path.join(tmp, "codex-home")
|
codex_home = os.path.join(tmp, "codex-home")
|
||||||
@@ -458,7 +462,7 @@ class GithubPRTest(unittest.TestCase):
|
|||||||
_init_git_repo(tmp)
|
_init_git_repo(tmp)
|
||||||
Path(tmp, "f.txt").write_text("x\n")
|
Path(tmp, "f.txt").write_text("x\n")
|
||||||
subprocess.run(["git", "add", "-A"], cwd=tmp, check=True)
|
subprocess.run(["git", "add", "-A"], cwd=tmp, check=True)
|
||||||
subprocess.run(["git", "commit", "-qm", "initial"],
|
subprocess.run(["git", "-c", "user.name=Test", "-c", "user.email=test@example.com", "commit", "-qm", "initial"],
|
||||||
cwd=tmp, check=True)
|
cwd=tmp, check=True)
|
||||||
task = {"name": "t", "branch": "host/t", "status": "completed",
|
task = {"name": "t", "branch": "host/t", "status": "completed",
|
||||||
"prompt": "do it"}
|
"prompt": "do it"}
|
||||||
@@ -473,12 +477,12 @@ class GithubPRTest(unittest.TestCase):
|
|||||||
_init_git_repo(repo)
|
_init_git_repo(repo)
|
||||||
Path(repo, "f.txt").write_text("x\n")
|
Path(repo, "f.txt").write_text("x\n")
|
||||||
subprocess.run(["git", "add", "-A"], cwd=repo, check=True)
|
subprocess.run(["git", "add", "-A"], cwd=repo, check=True)
|
||||||
subprocess.run(["git", "commit", "-qm", "initial"],
|
subprocess.run(["git", "-c", "user.name=Test", "-c", "user.email=test@example.com", "commit", "-qm", "initial"],
|
||||||
cwd=repo, check=True)
|
cwd=repo, check=True)
|
||||||
subprocess.run(["git", "checkout", "-qb", "host/t1"],
|
subprocess.run(["git", "checkout", "-qb", "host/t1"],
|
||||||
cwd=repo, check=True)
|
cwd=repo, check=True)
|
||||||
Path(repo, "f.txt").write_text("y\n")
|
Path(repo, "f.txt").write_text("y\n")
|
||||||
subprocess.run(["git", "commit", "-qam", "change"],
|
subprocess.run(["git", "-c", "user.name=Test", "-c", "user.email=test@example.com", "commit", "-qam", "change"],
|
||||||
cwd=repo, check=True)
|
cwd=repo, check=True)
|
||||||
remote = os.path.join(tmp, "remote.git")
|
remote = os.path.join(tmp, "remote.git")
|
||||||
subprocess.run(["git", "init", "--bare", "-q", remote],
|
subprocess.run(["git", "init", "--bare", "-q", remote],
|
||||||
|
|||||||
Reference in new issue
Block a user