修复:服务器测试数据路径目录导入保留目录 basename(proteomes/ 层级不再丢失)
This commit is contained in:
@@ -68,7 +68,7 @@ def _server_data_files(value: str | None) -> list[tuple[Path, Path]]:
|
||||
if not source.is_dir():
|
||||
raise ValueError(f"测试数据路径不是普通文件或目录:{text}")
|
||||
files.extend(
|
||||
(item.relative_to(source), item.resolve())
|
||||
(item.relative_to(source.parent), item.resolve())
|
||||
for item in sorted(source.rglob("*"))
|
||||
if item.is_file()
|
||||
)
|
||||
|
||||
@@ -272,8 +272,32 @@ def test_upload_expands_server_data_directory_preserving_relative_layout(tmp_pat
|
||||
assert response.status_code == 202
|
||||
assert len(queued) == 1
|
||||
staged = tmp_path / "store" / "staging" / "upload-server-directory" / "raw_test_data"
|
||||
assert (staged / "input.fa").is_symlink()
|
||||
assert (staged / "nested" / "model.hmm").is_symlink()
|
||||
assert (staged / "large_case" / "input.fa").is_symlink()
|
||||
assert (staged / "large_case" / "nested" / "model.hmm").is_symlink()
|
||||
|
||||
|
||||
def test_upload_server_data_directory_keeps_basename_for_flat_tool_input(tmp_path: Path) -> None:
|
||||
"""目录导入保留目录名本身:run.sh 里写死 -f proteomes 时数据必须落在 proteomes/ 下。"""
|
||||
client, queued = _client(tmp_path)
|
||||
source = tmp_path / "proteomes"
|
||||
source.mkdir()
|
||||
(source / "01.col.fa").write_text(">a\nAAAA\n", encoding="utf-8")
|
||||
(source / "02.tibet.fa").write_text(">b\nBBBB\n", encoding="utf-8")
|
||||
|
||||
response = client.post(
|
||||
"/api/lightweight-extension-stages/upload",
|
||||
data={
|
||||
"extension_id": "flat_tool_input",
|
||||
"original_command": "ls proteomes",
|
||||
"operation_token": "upload-flat-tool-input",
|
||||
"raw_data_paths": str(source),
|
||||
},
|
||||
)
|
||||
|
||||
assert response.status_code == 202
|
||||
staged = tmp_path / "store" / "staging" / "upload-flat-tool-input" / "raw_test_data"
|
||||
assert (staged / "proteomes" / "01.col.fa").is_symlink()
|
||||
assert (staged / "proteomes" / "02.tibet.fa").is_symlink()
|
||||
|
||||
|
||||
def test_upload_rejects_missing_server_data_path(tmp_path: Path) -> None:
|
||||
|
||||
Reference in New Issue
Block a user