modify pdftomd
This commit is contained in:
+21
-5
@@ -165,7 +165,7 @@ def test_doctor_warns_when_gpu_and_pytorch_are_missing(tmp_path: Path) -> None:
|
||||
|
||||
|
||||
def test_doctor_warns_for_gtx_1070_ti_pascal_risk(tmp_path: Path) -> None:
|
||||
report = make_report(tmp_path, gpu_stdout="NVIDIA GeForce GTX 1070 Ti, 8192 MiB, 551.86\n")
|
||||
report = make_report(tmp_path, gpu_stdout="0, NVIDIA GeForce GTX 1070 Ti, 8192, 551.86\n")
|
||||
|
||||
gpu_check = find_check(report, "gpu")
|
||||
assert report.status == "warn"
|
||||
@@ -181,7 +181,7 @@ def test_doctor_warns_for_pytorch_pre_turing_capability(tmp_path: Path) -> None:
|
||||
|
||||
report = make_report(
|
||||
tmp_path,
|
||||
gpu_stdout="NVIDIA RTX 4060, 8192 MiB, 551.86\n",
|
||||
gpu_stdout="0, NVIDIA RTX 4060, 8192, 551.86\n",
|
||||
import_module=fake_pascal_torch,
|
||||
)
|
||||
|
||||
@@ -220,7 +220,7 @@ def test_doctor_warns_when_mathjax_health_fails(tmp_path: Path) -> None:
|
||||
def failing_runner(command: tuple[str, ...]) -> DoctorCommandResult:
|
||||
if command[-1] == "--health":
|
||||
return DoctorCommandResult(command, 1, stderr="Cannot find package 'mathjax'")
|
||||
return command_runner("NVIDIA RTX 4060, 8192 MiB, 551.86\n")(command)
|
||||
return command_runner("0, NVIDIA RTX 4060, 8192, 551.86\n")(command)
|
||||
|
||||
report = make_report(tmp_path, run_command=failing_runner)
|
||||
|
||||
@@ -232,7 +232,7 @@ def test_doctor_warns_when_mathjax_health_fails(tmp_path: Path) -> None:
|
||||
|
||||
|
||||
def test_format_doctor_report_is_stable(tmp_path: Path) -> None:
|
||||
report = make_report(tmp_path, gpu_stdout="NVIDIA GeForce GTX 1070 Ti, 8192 MiB, 551.86\n")
|
||||
report = make_report(tmp_path, gpu_stdout="0, NVIDIA GeForce GTX 1070 Ti, 8192, 551.86\n")
|
||||
|
||||
formatted = format_doctor_report(report)
|
||||
|
||||
@@ -241,13 +241,29 @@ def test_format_doctor_report_is_stable(tmp_path: Path) -> None:
|
||||
assert "[PASS] local-only:" in formatted
|
||||
|
||||
|
||||
def test_doctor_reports_auto_gpu_and_recommended_profile(tmp_path: Path) -> None:
|
||||
report = make_report(
|
||||
tmp_path,
|
||||
gpu_stdout=(
|
||||
"0, NVIDIA RTX 4060, 8192, 577.00\n"
|
||||
"1, NVIDIA RTX 4090, 24564, 577.00\n"
|
||||
),
|
||||
)
|
||||
|
||||
gpu_check = find_check(report, "gpu")
|
||||
assert gpu_check.status == "pass"
|
||||
assert any("gpu 1: NVIDIA RTX 4090, 24564 MiB, driver 577.00" in detail for detail in gpu_check.details)
|
||||
assert any("auto gpu: cuda:1" in detail for detail in gpu_check.details)
|
||||
assert any("recommended MinerU profile: auto" in detail for detail in gpu_check.details)
|
||||
|
||||
|
||||
def make_report(
|
||||
tmp_path: Path,
|
||||
*,
|
||||
python_version: tuple[int, int, int] = (3, 12, 7),
|
||||
available_tools: dict[str, str] | None = None,
|
||||
mineru_result: MinerUVersionResult | None = None,
|
||||
gpu_stdout: str = "NVIDIA RTX 4060, 8192 MiB, 551.86\n",
|
||||
gpu_stdout: str = "0, NVIDIA RTX 4060, 8192, 551.86\n",
|
||||
env: dict[str, str] | None = None,
|
||||
existing_paths: set[Path] | None = None,
|
||||
import_module=None,
|
||||
|
||||
Reference in New Issue
Block a user