From 399af96c6d66fa40c4bb88e9e1fc1e68e03b7b33 Mon Sep 17 00:00:00 2001 From: Zhenyu Wang Date: Thu, 28 Mar 2024 23:15:36 +0800 Subject: [PATCH] fix: fix UT --- tests/test_caly_evo_step.py | 28 ++++++++++++++-------------- tests/test_collect_data.py | 4 ++-- tests/test_prep_run_caly.py | 28 ++++++++++++++-------------- tests/test_prep_run_dp_train.py | 22 +++++++++++----------- tests/test_prep_run_lmp.py | 24 ++++++++++++------------ tests/test_prep_run_vasp.py | 26 +++++++++++++------------- tests/test_select_confs.py | 10 +++++----- 7 files changed, 71 insertions(+), 71 deletions(-) diff --git a/tests/test_caly_evo_step.py b/tests/test_caly_evo_step.py index a75b50bb..bc651e09 100644 --- a/tests/test_caly_evo_step.py +++ b/tests/test_caly_evo_step.py @@ -51,6 +51,20 @@ except ModuleNotFoundError: # case of upload everything to argo, no context needed pass +from context import ( + default_host, + default_image, + skip_ut_with_dflow, + skip_ut_with_dflow_reason, + upload_python_packages, +) +from mocked_ops import ( + MockedCollRunCaly, + MockedPrepDPOptim, + MockedRunDPOptim, + mocked_numb_models, +) + from dpgen2.constants import ( lmp_conf_name, lmp_input_name, @@ -82,20 +96,6 @@ ) from dpgen2.utils.step_config import normalize as normalize_step_dict -from .context import ( - default_host, - default_image, - skip_ut_with_dflow, - skip_ut_with_dflow_reason, - upload_python_packages, -) -from .mocked_ops import ( - MockedCollRunCaly, - MockedPrepDPOptim, - MockedRunDPOptim, - mocked_numb_models, -) - default_config = normalize_step_dict( { "template_config": { diff --git a/tests/test_collect_data.py b/tests/test_collect_data.py index be7d192d..95b7e4c9 100644 --- a/tests/test_collect_data.py +++ b/tests/test_collect_data.py @@ -44,14 +44,14 @@ except ModuleNotFoundError: # case of upload everything to argo, no context needed pass -from .context import ( +from context import ( default_host, default_image, skip_ut_with_dflow, skip_ut_with_dflow_reason, upload_python_packages, ) -from .mocked_ops import ( +from mocked_ops import ( MockedCollectData, ) diff --git a/tests/test_prep_run_caly.py b/tests/test_prep_run_caly.py index d2f5d946..5daa600f 100644 --- a/tests/test_prep_run_caly.py +++ b/tests/test_prep_run_caly.py @@ -51,6 +51,20 @@ except ModuleNotFoundError: # case of upload everything to argo, no context needed pass +from context import ( + default_host, + default_image, + skip_ut_with_dflow, + skip_ut_with_dflow_reason, + upload_python_packages, +) +from mocked_ops import ( + MockedCollRunCaly, + MockedRunCalyModelDevi, + MockedRunDPOptim, + mocked_numb_models, +) + from dpgen2.exploration.task import ( BaseExplorationTaskGroup, ExplorationTask, @@ -72,20 +86,6 @@ ) from dpgen2.utils.step_config import normalize as normalize_step_dict -from .context import ( - default_host, - default_image, - skip_ut_with_dflow, - skip_ut_with_dflow_reason, - upload_python_packages, -) -from .mocked_ops import ( - MockedCollRunCaly, - MockedRunCalyModelDevi, - MockedRunDPOptim, - mocked_numb_models, -) - prep_default_config = normalize_step_dict( { "template_config": { diff --git a/tests/test_prep_run_dp_train.py b/tests/test_prep_run_dp_train.py index 7deeac3e..22eb40ba 100644 --- a/tests/test_prep_run_dp_train.py +++ b/tests/test_prep_run_dp_train.py @@ -42,23 +42,14 @@ except ModuleNotFoundError: # case of upload everything to argo, no context needed pass -from dpgen2.constants import ( - train_task_pattern, -) -from dpgen2.superop.prep_run_dp_train import ( - ModifyTrainScript, - PrepRunDPTrain, -) -from dpgen2.utils.step_config import normalize as normalize_step_dict - -from .context import ( +from context import ( default_host, default_image, skip_ut_with_dflow, skip_ut_with_dflow_reason, upload_python_packages, ) -from .mocked_ops import ( +from mocked_ops import ( MockedModifyTrainScript, MockedPrepDPTrain, MockedRunDPTrain, @@ -69,6 +60,15 @@ mocked_template_script, ) +from dpgen2.constants import ( + train_task_pattern, +) +from dpgen2.superop.prep_run_dp_train import ( + ModifyTrainScript, + PrepRunDPTrain, +) +from dpgen2.utils.step_config import normalize as normalize_step_dict + default_config = normalize_step_dict( { "template_config": { diff --git a/tests/test_prep_run_lmp.py b/tests/test_prep_run_lmp.py index 4ce6d4e4..3b350240 100644 --- a/tests/test_prep_run_lmp.py +++ b/tests/test_prep_run_lmp.py @@ -44,6 +44,18 @@ except ModuleNotFoundError: # case of upload everything to argo, no context needed pass +from context import ( + default_host, + default_image, + skip_ut_with_dflow, + skip_ut_with_dflow_reason, + upload_python_packages, +) +from mocked_ops import ( + MockedRunLmp, + mocked_numb_models, +) + from dpgen2.constants import ( lmp_conf_name, lmp_input_name, @@ -68,18 +80,6 @@ ) from dpgen2.utils.step_config import normalize as normalize_step_dict -from .context import ( - default_host, - default_image, - skip_ut_with_dflow, - skip_ut_with_dflow_reason, - upload_python_packages, -) -from .mocked_ops import ( - MockedRunLmp, - mocked_numb_models, -) - default_config = normalize_step_dict( { "template_config": { diff --git a/tests/test_prep_run_vasp.py b/tests/test_prep_run_vasp.py index 9246fbe1..77030bff 100644 --- a/tests/test_prep_run_vasp.py +++ b/tests/test_prep_run_vasp.py @@ -43,6 +43,19 @@ except ModuleNotFoundError: # case of upload everything to argo, no context needed pass +from context import ( + default_host, + default_image, + skip_ut_with_dflow, + skip_ut_with_dflow_reason, + upload_python_packages, +) +from mocked_ops import ( + MockedPrepVasp, + MockedRunVasp, + mocked_incar_template, +) + from dpgen2.constants import ( fp_task_pattern, ) @@ -57,19 +70,6 @@ ) from dpgen2.utils.step_config import normalize as normalize_step_dict -from .context import ( - default_host, - default_image, - skip_ut_with_dflow, - skip_ut_with_dflow_reason, - upload_python_packages, -) -from .mocked_ops import ( - MockedPrepVasp, - MockedRunVasp, - mocked_incar_template, -) - default_config = normalize_step_dict( { "template_config": { diff --git a/tests/test_select_confs.py b/tests/test_select_confs.py index 576ef36f..c8840eaf 100644 --- a/tests/test_select_confs.py +++ b/tests/test_select_confs.py @@ -45,16 +45,16 @@ except ModuleNotFoundError: # case of upload everything to argo, no context needed pass -from dpgen2.op.select_confs import ( - SelectConfs, -) - -from .mocked_ops import ( +from mocked_ops import ( MockedConfSelector, MockedExplorationReport, MockedSelectConfs, ) +from dpgen2.op.select_confs import ( + SelectConfs, +) + class TestMockedSelectConfs(unittest.TestCase): def setUp(self):