From 30e25adaacd1bd30843d76efa3128ee4aef07e2f Mon Sep 17 00:00:00 2001 From: fandawei Date: Wed, 20 Dec 2023 20:39:59 +0800 Subject: [PATCH] fix get_name_map_list_by_number not find file bug --- .jenkins/test/config/dependent_packages.yaml | 2 +- tests/st/troubleshooter/migrator/test_compare_list.py | 7 ------- troubleshooter/troubleshooter/common/util.py | 2 +- troubleshooter/troubleshooter/migrator/diff_handler.py | 4 ++-- 4 files changed, 4 insertions(+), 11 deletions(-) diff --git a/.jenkins/test/config/dependent_packages.yaml b/.jenkins/test/config/dependent_packages.yaml index 9ecacf2..eddbb42 100644 --- a/.jenkins/test/config/dependent_packages.yaml +++ b/.jenkins/test/config/dependent_packages.yaml @@ -1,2 +1,2 @@ mindspore: - '/mindspore/mindspore/daily/202312/20231207/r2.3_20231207021527_98f3c5d6aa5e765731af4f7bba6816a96693d5b3_newest/' + '/mindspore/mindspore/daily/202312/20231220/r2.3_20231220021524_304f51f9313193bde49794602ad058f893a0373a_newest/' diff --git a/tests/st/troubleshooter/migrator/test_compare_list.py b/tests/st/troubleshooter/migrator/test_compare_list.py index e8a5038..5e99df7 100644 --- a/tests/st/troubleshooter/migrator/test_compare_list.py +++ b/tests/st/troubleshooter/migrator/test_compare_list.py @@ -10,13 +10,8 @@ import pytest @pytest.mark.level0 -@pytest.mark.platform_x86_cpu -@pytest.mark.platform_arm_cpu @pytest.mark.platform_x86_gpu_training -@pytest.mark.platform_arm_ascend_training -@pytest.mark.platform_x86_ascend_training @pytest.mark.env_onecard -@pytest.mark.skip() def test_compare_list_dir(capsys): dir1 = tempfile.TemporaryDirectory() dir2 = tempfile.TemporaryDirectory() @@ -31,6 +26,4 @@ def test_compare_list_dir(capsys): ts.migrator.compare_list_dir(path1, path2) result = capsys.readouterr().out - assert result.count('True') == 2 - diff --git a/troubleshooter/troubleshooter/common/util.py b/troubleshooter/troubleshooter/common/util.py index 98bd722..b8e9a28 100644 --- a/troubleshooter/troubleshooter/common/util.py +++ b/troubleshooter/troubleshooter/common/util.py @@ -112,7 +112,7 @@ def extract_end_number(string): return [] -def find_file(dir, suffix=".npy", sort_key=extract_front_end_number): +def find_file(dir, *, suffix=".npy", sort_key=extract_front_end_number): file_list = [] normal_dir = validate_and_normalize_path(dir) walk_generator = os.walk(normal_dir) diff --git a/troubleshooter/troubleshooter/migrator/diff_handler.py b/troubleshooter/troubleshooter/migrator/diff_handler.py index b910d8e..52e984b 100644 --- a/troubleshooter/troubleshooter/migrator/diff_handler.py +++ b/troubleshooter/troubleshooter/migrator/diff_handler.py @@ -69,8 +69,8 @@ def get_name_map_list_by_name(orig_dir, target_dir): def get_name_map_list_by_number(orig_dir, target_dir, sort_key=extract_front_end_number): - orig_name_list = find_file(orig_dir, sort_key) - target_name_list = find_file(target_dir, sort_key) + orig_name_list = find_file(orig_dir, sort_key=sort_key) + target_name_list = find_file(target_dir, sort_key=sort_key) if not (orig_name_list and target_name_list): raise ValueError("The comparison file is not found in the directory. Please \ check whether the directory is correct") -- Gitee