Skip to content

Commit

Permalink
test(rapidocr_onnxruntime): Add two unit testings about cuda and dml
Browse files Browse the repository at this point in the history
  • Loading branch information
SWHL committed May 21, 2024
1 parent 35e85ef commit 02829ef
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions python/tests/test_ort.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- encoding: utf-8 -*-
# @Author: SWHL
# @Contact: [email protected]
import logging
import sys
from pathlib import Path

Expand All @@ -20,6 +21,22 @@
package_name = "rapidocr_onnxruntime"


def test_ort_cuda_warning(caplog):
engine = RapidOCR(det_use_cuda=True)
caplog.set_level(logging.WARNING)

assert caplog.records[0].levelname == "WARNING"
assert "CUDAExecutionProvider" in caplog.records[0].message


def test_ort_dml_warning(caplog):
engine = RapidOCR(det_use_dml=True)
caplog.set_level(logging.WARNING)

assert caplog.records[0].levelname == "WARNING"
assert "DirectML" in caplog.records[0].message


def test_mode_one_img():
img_path = tests_dir / "issue_170.png"
result, _ = engine(img_path)
Expand Down

0 comments on commit 02829ef

Please sign in to comment.