refactor: Rename IPSExtractor to Flujo IPS across the project. Update titles, descriptions, and labels in the API, desktop application, and documentation to reflect the new branding. Introduce a new .gitignore for CodeGraph data files and adjust existing .gitignore to include specific directories. Enhance the desktop application with new components for displaying bot progress and results.
This commit is contained in:
@@ -0,0 +1,84 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import importlib
|
||||
import sys
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.fixture()
|
||||
def store(tmp_path, monkeypatch):
|
||||
db_url = f"sqlite:///{(tmp_path / 'digitador.db').as_posix()}"
|
||||
monkeypatch.setenv("DATABASE_URL", db_url)
|
||||
for name in ["infrastructure.database", "infrastructure.store"]:
|
||||
if name in sys.modules:
|
||||
importlib.reload(sys.modules[name])
|
||||
else:
|
||||
importlib.import_module(name)
|
||||
|
||||
from infrastructure import database as db
|
||||
|
||||
importlib.reload(db)
|
||||
import infrastructure.store as store_mod
|
||||
|
||||
importlib.reload(store_mod)
|
||||
from domain.models import JobStatus
|
||||
|
||||
return store_mod.JobStore(), JobStatus
|
||||
|
||||
|
||||
def test_distributed_parent_uses_agent_counters_and_live_progress(store):
|
||||
job_store, JobStatus = store
|
||||
parent = job_store.create_job(
|
||||
None,
|
||||
"uploads/parent/input.csv",
|
||||
"input.csv",
|
||||
shard_count=2,
|
||||
result={"total_rows": 8, "processed": 0},
|
||||
status=JobStatus.PENDING.value,
|
||||
)
|
||||
first = job_store.create_job(
|
||||
"PC-01",
|
||||
"uploads/first/input.csv",
|
||||
parent_digitador_job_id=parent.id,
|
||||
shard_index=0,
|
||||
shard_count=2,
|
||||
result={"total": 4, "processed": 2},
|
||||
status=JobStatus.RUNNING.value,
|
||||
)
|
||||
second = job_store.create_job(
|
||||
"PC-02",
|
||||
"uploads/second/input.csv",
|
||||
parent_digitador_job_id=parent.id,
|
||||
shard_index=1,
|
||||
shard_count=2,
|
||||
result={"total": 4, "processed": 1},
|
||||
status=JobStatus.RUNNING.value,
|
||||
)
|
||||
|
||||
live = job_store.refresh_parent_from_shards(parent.id)
|
||||
assert live is not None
|
||||
assert live.result["processed"] == 3
|
||||
assert live.result["total"] == 8
|
||||
|
||||
job_store.patch_job(
|
||||
first.id,
|
||||
status=JobStatus.COMPLETED.value,
|
||||
result={
|
||||
"total": 4,
|
||||
"exitosos": 1,
|
||||
"fallidos": 2,
|
||||
"omitidos": 1,
|
||||
"timeouts": 1,
|
||||
"existentes": 1,
|
||||
"uploaded_count": 3,
|
||||
},
|
||||
)
|
||||
live = job_store.refresh_parent_from_shards(parent.id)
|
||||
assert live is not None
|
||||
assert live.result["processed"] == 5
|
||||
assert live.result["exitosos"] == 1
|
||||
assert live.result["fallidos"] == 2
|
||||
assert live.result["existentes"] == 1
|
||||
assert live.result["timeouts"] == 1
|
||||
assert live.result["uploaded_count"] == 3
|
||||
Reference in New Issue
Block a user