feat: complete production workflow migration
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from gyxx_flow.modules.supply_chain.orchestrator.scripts import batch_process
|
||||
|
||||
|
||||
def test_batch_only_selects_an_xlsx_from_the_current_collection(
|
||||
tmp_path: Path,
|
||||
monkeypatch: pytest.MonkeyPatch,
|
||||
) -> None:
|
||||
monkeypatch.setattr(batch_process, "DATA_DIR", tmp_path)
|
||||
old = tmp_path / "补货建议_旧.xlsx"
|
||||
current = tmp_path / "补货建议_本次.xlsx"
|
||||
old.write_bytes(b"old")
|
||||
current.write_bytes(b"current")
|
||||
os.utime(old, (100.0, 100.0))
|
||||
os.utime(current, (201.0, 201.0))
|
||||
|
||||
assert batch_process._pick_latest_xlsx(since_epoch=200.0) == current
|
||||
assert batch_process._pick_latest_xlsx(since_epoch=202.0) is None
|
||||
|
||||
|
||||
def test_no_replenishment_is_encoded_as_a_successful_business_result() -> None:
|
||||
source = (
|
||||
Path(batch_process.__file__).with_name("ProductReplenishment.py")
|
||||
).read_text(encoding="utf-8-sig")
|
||||
|
||||
assert "completed_without_replenishment = True" in source
|
||||
assert "return filepath or completed_without_replenishment" in source
|
||||
Reference in New Issue
Block a user