mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-07-03 13:19:23 +08:00
test(assets): make duplicate path normalization portable
Amp-Thread-ID: https://ampcode.com/threads/T-019ecf39-2e6f-747d-ae80-addba6b8e4f5 Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
parent
ccc9387298
commit
ca5adea2e3
@ -1,5 +1,6 @@
|
|||||||
"""Tests for bulk ingest services."""
|
"""Tests for bulk ingest services."""
|
||||||
|
|
||||||
|
import os
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
@ -156,6 +157,7 @@ class TestBatchInsertSeedAssets:
|
|||||||
file_path.write_bytes(b"shared model")
|
file_path.write_bytes(b"shared model")
|
||||||
monkeypatch.chdir(temp_dir)
|
monkeypatch.chdir(temp_dir)
|
||||||
relative_path = file_path.name
|
relative_path = file_path.name
|
||||||
|
absolute_path = os.path.abspath(relative_path)
|
||||||
|
|
||||||
specs: list[SeedAssetSpec] = [
|
specs: list[SeedAssetSpec] = [
|
||||||
{
|
{
|
||||||
@ -170,7 +172,7 @@ class TestBatchInsertSeedAssets:
|
|||||||
"mime_type": "application/safetensors",
|
"mime_type": "application/safetensors",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"abs_path": str(file_path),
|
"abs_path": absolute_path,
|
||||||
"size_bytes": 12,
|
"size_bytes": 12,
|
||||||
"mtime_ns": 1234567890000000000,
|
"mtime_ns": 1234567890000000000,
|
||||||
"info_name": "Shared Model",
|
"info_name": "Shared Model",
|
||||||
@ -188,7 +190,7 @@ class TestBatchInsertSeedAssets:
|
|||||||
assert result.won_paths == 1
|
assert result.won_paths == 1
|
||||||
refs = session.query(AssetReference).all()
|
refs = session.query(AssetReference).all()
|
||||||
assert len(refs) == 1
|
assert len(refs) == 1
|
||||||
assert refs[0].file_path == str(file_path)
|
assert refs[0].file_path == absolute_path
|
||||||
assert set(get_reference_tags(session, reference_id=refs[0].id)) == {
|
assert set(get_reference_tags(session, reference_id=refs[0].id)) == {
|
||||||
"models",
|
"models",
|
||||||
"model_type:checkpoints",
|
"model_type:checkpoints",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user