-
-
Notifications
You must be signed in to change notification settings - Fork 386
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(rapidocr_onnxruntime): Add two unit testings about cuda and dml
- Loading branch information
Showing
1 changed file
with
17 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
||
|
@@ -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) | ||
|