| | import time |
| | import pytest |
| |
|
| | from lib.asr_models.base_model import ModelName |
| | from test_data import DataName |
| |
|
| | def pytest_addoption(parser): |
| | |
| | parser.addoption( |
| | "--model", |
| | action="store", |
| | required=True, |
| | nargs="+", |
| | choices=["whisper", "whisper_finetuned", "funasr_nano", "funasr_mlt_nano","funasr_quant", "all"], |
| | help="Models to run" |
| | ) |
| | parser.addoption( |
| | "--dataset", |
| | action="store", |
| | required=True, |
| | nargs="+", |
| | choices=["wenet_net", "wenet_meeting", "librispeech_clean", "librispeech_other", "aishell2", "recording"], |
| | help=f"Datasets to use" |
| | ) |
| |
|
| | def pytest_generate_tests(metafunc): |
| | |
| | |
| | |
| | if "model" in metafunc.fixturenames: |
| | model_list = metafunc.config.getoption("model") |
| | if "all" in model_list: |
| | model_list = [m.value for m in ModelName] |
| | metafunc.parametrize("model", model_list) |
| |
|
| | |
| | if "dataset" in metafunc.fixturenames: |
| | dataset_list = metafunc.config.getoption("dataset") |
| | metafunc.parametrize("dataset", dataset_list) |
| |
|
| | @pytest.fixture(scope="module") |
| | def summary(request): |
| | |
| | summary = [] |
| | yield summary |
| | print("\n\n") |
| | print("*"*50) |
| | [print(s) for s in summary] |
| | print("*" * 50) |
| |
|
| | @pytest.fixture(scope="function", autouse=True) |
| | def print_log(request): |
| | model_name = request.node.callspec.params.get("model") |
| | dataset_name = request.node.callspec.params.get("dataset") |
| | print("\n", "#"*30,model_name, "-", dataset_name, "start", "#"*30, "\n") |
| | yield |
| | print("\n", "#" * 30, model_name, "-", dataset_name, "end", "#" * 30, "\n") |
| | time.sleep(30) |
| |
|
| |
|