repo hygiene, tooling config, v0.2.0
Some checks failed
tests / core (macos-latest, py3.11) (push) Has been cancelled
tests / core (macos-latest, py3.12) (push) Has been cancelled
tests / core (macos-latest, py3.13) (push) Has been cancelled
tests / core (ubuntu-latest, py3.11) (push) Has been cancelled
tests / core (ubuntu-latest, py3.12) (push) Has been cancelled
tests / core (ubuntu-latest, py3.13) (push) Has been cancelled
tests / doctor CLI smoke test (push) Has been cancelled
Some checks failed
tests / core (macos-latest, py3.11) (push) Has been cancelled
tests / core (macos-latest, py3.12) (push) Has been cancelled
tests / core (macos-latest, py3.13) (push) Has been cancelled
tests / core (ubuntu-latest, py3.11) (push) Has been cancelled
tests / core (ubuntu-latest, py3.12) (push) Has been cancelled
tests / core (ubuntu-latest, py3.13) (push) Has been cancelled
tests / doctor CLI smoke test (push) Has been cancelled
- Untrack src/ocr_pipeline.egg-info from git, delete pyproject.toml~, stale run_008/run_009 dirs - Ruff config moved to [tool.ruff.lint] (silences deprecation warning) - Pre-commit: bump revs (ruff v0.14.13, mypy v1.18.1, hooks v6.0.0); drop redundant isort hook (ruff I already sorts imports) - mypy: add ignore_missing_imports for optional deps; types-PyYAML in dev extras; python_version=3.12 for numpy 2.5 stubs compat; CI step - Doctor: suppress paddle ccache UserWarning noise during check - CHANGELOG dated for 0.2.0; README minimal-style rewrite with collapsible details sections - Bump version to 0.2.0
This commit is contained in:
@@ -53,10 +53,22 @@ def test_check_paddle_warns_when_missing(monkeypatch) -> None:
|
||||
|
||||
def test_check_torch_reports_backend(monkeypatch) -> None:
|
||||
monkeypatch.setattr("ocr_pipeline.doctor._has_module", lambda name: True)
|
||||
fake_torch = type(
|
||||
"T", (), {"cuda": type("C", (), {"is_available": staticmethod(lambda: False)})()}
|
||||
)
|
||||
monkeypatch.setattr("sys.modules", {"torch": fake_torch})
|
||||
|
||||
class FakeMPS:
|
||||
@staticmethod
|
||||
def is_available(): # type: ignore[no-untyped-def]
|
||||
return False
|
||||
|
||||
class FakeBackends:
|
||||
mps = FakeMPS
|
||||
|
||||
class FakeCuda:
|
||||
@staticmethod
|
||||
def is_available(): # type: ignore[no-untyped-def]
|
||||
return False
|
||||
|
||||
fake_torch = type("T", (), {"cuda": FakeCuda, "backends": FakeBackends})
|
||||
monkeypatch.setitem(__import__("sys").modules, "torch", fake_torch)
|
||||
r = check_torch()
|
||||
assert r.status == "ok"
|
||||
assert "backend=" in r.detail
|
||||
|
||||
Reference in New Issue
Block a user