Skip to content

Commit 8eb9d75

Browse files
committed
🧪 tests: update example testcase.
1 parent c0ac4ec commit 8eb9d75

File tree

2 files changed

+17
-21
lines changed

2 files changed

+17
-21
lines changed

src/ddeutil/workflow/traces.py

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -954,27 +954,16 @@ def find_traces(
954954
except Exception as e:
955955
logger.error(f"Failed to read from SQLite database: {e}")
956956

957-
@classmethod
958957
def find_trace_with_id(
959-
cls,
958+
self,
960959
run_id: str,
961960
force_raise: bool = True,
962961
*,
963962
path: Optional[Path] = None,
964963
extras: Optional[DictData] = None,
965964
) -> TraceData:
966965
"""Find trace log with specific run ID from SQLite database."""
967-
if path is None:
968-
url = dynamic("trace_url", extras=extras)
969-
if (
970-
url is not None
971-
and hasattr(url, "path")
972-
and getattr(url, "path", None)
973-
):
974-
path = Path(url.path)
975-
else:
976-
path = Path("./logs/workflow_traces.db")
977-
966+
path = path or Path(self.path)
978967
if not path.exists():
979968
if force_raise:
980969
raise FileNotFoundError(f"SQLite database not found: {path}")

tests/example/test_stage_example.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,36 @@
11
import os
2-
import shutil
32
from datetime import datetime
4-
from urllib.parse import urlparse
53

64
from ddeutil.workflow import SUCCESS, Result, Workflow
75

86

97
def test_example_stage_exec_nested_trigger(test_path):
10-
if (test_path / "example/logs").exists():
11-
shutil.rmtree(test_path / "example/logs")
8+
# if (test_path / "example/logs").exists():
9+
# shutil.rmtree(test_path / "example/logs")
1210

1311
workflow = Workflow.from_conf(
1412
"stream-workflow",
1513
extras={
16-
"trace_url": urlparse(str(test_path / "example/logs/trace")),
17-
"audit_url": str(test_path / "example/logs/audit"),
18-
"enable_write_log": True,
14+
"trace_handlers": [
15+
{"type": "console"},
16+
{
17+
"type": "file",
18+
"path": str((test_path / "example/logs/trace").absolute()),
19+
},
20+
],
21+
"audit_conf": {
22+
"type": "file",
23+
"path": str((test_path / "example/logs/audit").absolute()),
24+
},
1925
"enable_write_audit": True,
2026
},
2127
)
2228

2329
os.environ["EXAMPLE_SECRET_TOKEN"] = "very-secret-value"
2430

2531
rs: Result = workflow.release(
26-
datetime(2025, 5, 10, 12, 35),
32+
# datetime(2025, 5, 10, 12, 35),
33+
datetime.now(),
2734
params={
2835
"run-mode": "N",
2936
"name": "starter-stream-name",

0 commit comments

Comments
 (0)