mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2025-12-17 01:52:59 +08:00
fixed tests on SQLite file
This commit is contained in:
parent
dda31de690
commit
7becb84341
@ -274,7 +274,7 @@ async def trigger_sync_seed_assets(session: aiohttp.ClientSession, base_url: str
|
|||||||
"""Force a fast sync/seed pass by calling the ComfyUI '/object_info' endpoint."""
|
"""Force a fast sync/seed pass by calling the ComfyUI '/object_info' endpoint."""
|
||||||
async with session.get(base_url + "/object_info") as r:
|
async with session.get(base_url + "/object_info") as r:
|
||||||
await r.read()
|
await r.read()
|
||||||
await asyncio.sleep(0.05) # tiny yield to the event loop to let any final DB commits flush
|
await asyncio.sleep(0.1) # tiny yield to the event loop to let any final DB commits flush
|
||||||
|
|
||||||
|
|
||||||
@pytest_asyncio.fixture
|
@pytest_asyncio.fixture
|
||||||
|
|||||||
@ -85,7 +85,7 @@ async def test_scan_status_filter_by_root_and_file_errors(
|
|||||||
data = b"A" * 4096
|
data = b"A" * 4096
|
||||||
await asset_factory(name_in, ["input", "unit-tests", in_scope, "deny"], {}, data)
|
await asset_factory(name_in, ["input", "unit-tests", in_scope, "deny"], {}, data)
|
||||||
try:
|
try:
|
||||||
os.chmod(protected_dir, 0x000)
|
os.chmod(protected_dir, 0o000)
|
||||||
|
|
||||||
# Also schedule a scan for output root (no errors there)
|
# Also schedule a scan for output root (no errors there)
|
||||||
out_scope = f"filter-out-{uuid.uuid4().hex[:6]}"
|
out_scope = f"filter-out-{uuid.uuid4().hex[:6]}"
|
||||||
@ -141,7 +141,7 @@ async def test_scan_records_file_errors_permission_denied(
|
|||||||
a1 = await asset_factory(name, [root, "unit-tests", scope, "deny"], {}, b"X" * 2048)
|
a1 = await asset_factory(name, [root, "unit-tests", scope, "deny"], {}, b"X" * 2048)
|
||||||
asset_filename = get_asset_filename(a1["asset_hash"], ".bin")
|
asset_filename = get_asset_filename(a1["asset_hash"], ".bin")
|
||||||
try:
|
try:
|
||||||
os.chmod(deny_dir, 0x000)
|
os.chmod(deny_dir, 0o000)
|
||||||
async with http.post(api_base + "/api/assets/scan/schedule", json={"roots": [root]}) as r:
|
async with http.post(api_base + "/api/assets/scan/schedule", json={"roots": [root]}) as r:
|
||||||
assert r.status == 202
|
assert r.status == 202
|
||||||
await run_scan_and_wait(root)
|
await run_scan_and_wait(root)
|
||||||
@ -157,7 +157,7 @@ async def test_scan_records_file_errors_permission_denied(
|
|||||||
assert any(e.get("path", "").endswith(asset_filename) and e.get("message") for e in errs)
|
assert any(e.get("path", "").endswith(asset_filename) and e.get("message") for e in errs)
|
||||||
finally:
|
finally:
|
||||||
try:
|
try:
|
||||||
os.chmod(deny_dir, 0x755)
|
os.chmod(deny_dir, 0o755)
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -402,7 +402,7 @@ async def test_sync_seed_nested_dirs_produce_parent_tags(
|
|||||||
# nested: unit-tests / scope / a / b / c / deep.txt
|
# nested: unit-tests / scope / a / b / c / deep.txt
|
||||||
deep_dir = _base_for(root, comfy_tmp_base_dir) / "unit-tests" / scope / "a" / "b" / "c"
|
deep_dir = _base_for(root, comfy_tmp_base_dir) / "unit-tests" / scope / "a" / "b" / "c"
|
||||||
deep_dir.mkdir(parents=True, exist_ok=True)
|
deep_dir.mkdir(parents=True, exist_ok=True)
|
||||||
(deep_dir / "deep.txt").write_bytes(b"content")
|
(deep_dir / "deep.txt").write_bytes(scope.encode())
|
||||||
|
|
||||||
await trigger_sync_seed_assets(http, api_base)
|
await trigger_sync_seed_assets(http, api_base)
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user