Spaces:
Running
Running
Upload 测试脚本.py
Browse files
测试脚本.py
CHANGED
|
@@ -132,9 +132,11 @@ class TestDatabaseConnection(unittest.TestCase):
|
|
| 132 |
def tearDown(self):
|
| 133 |
"""测试后清理"""
|
| 134 |
import os
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
|
|
|
|
|
|
| 138 |
|
| 139 |
def test_load_missing_file(self):
|
| 140 |
"""测试:加载不存在的文件返回空列表"""
|
|
|
|
| 132 |
def tearDown(self):
|
| 133 |
"""测试后清理"""
|
| 134 |
import os
|
| 135 |
+
# 🔧 修复:旧版清理路径写死为 data/,与实际存储目录(数据库连接.LOCAL_DB_DIR,本地为 cache/)不匹配导致残留
|
| 136 |
+
from 数据库连接 import LOCAL_DB_DIR, BACKUP_DIR
|
| 137 |
+
for test_path in (Path(LOCAL_DB_DIR) / self.test_file, Path(BACKUP_DIR) / f"{self.test_file}.bak"):
|
| 138 |
+
if test_path.exists():
|
| 139 |
+
os.remove(test_path)
|
| 140 |
|
| 141 |
def test_load_missing_file(self):
|
| 142 |
"""测试:加载不存在的文件返回空列表"""
|