fix: 校验顺序改路径字典序(显示直观) + 测试时序稳定性
This commit is contained in:
1 parent
0b28d26a18
commit
2e505f6ea3
2 files changed
+10
-2
No files matched your search
@@ -2,6 +2,7 @@
|
||||
import re
|
||||
import os
|
||||
import subprocess
|
||||
import time
|
||||
import sys
|
||||
|
||||
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
@@ -328,6 +329,11 @@ def test_pause_sends_sigstop(tmp_path):
|
||||
r.proc = p
|
||||
r.pause()
|
||||
assert r._paused is True
|
||||
# SIGSTOP 异步生效, 等待状态变 T
|
||||
for _ in range(20):
|
||||
if _proc_state(p.pid) == "T":
|
||||
break
|
||||
time.sleep(0.05)
|
||||
assert _proc_state(p.pid) == "T" # T = stopped
|
||||
p.kill()
|
||||
p.wait()
|
||||
|
||||
+4
-2
@@ -115,8 +115,10 @@ def verify_recent_files(src_dir: str, dst_dir: str, check_count: int = 5,
|
||||
full = os.path.join(root, name)
|
||||
recent.append((os.path.getmtime(full), os.path.relpath(full, dst_dir)))
|
||||
recent.sort(reverse=True)
|
||||
total = min(check_count, len(recent))
|
||||
for idx, (_mtime, rel) in enumerate(recent[:check_count], 1):
|
||||
# 选择最新 N 个 (按 mtime), 校验/显示顺序按路径字典序 (直观连续)
|
||||
selected = sorted(rel for _mtime, rel in recent[:check_count])
|
||||
total = len(selected)
|
||||
for idx, rel in enumerate(selected, 1):
|
||||
sp = os.path.join(src_dir, rel)
|
||||
tp = os.path.join(dst_dir, rel)
|
||||
if not os.path.isfile(sp):
|
||||
|
||||
Reference in new issue
Block a user