tests package

Subpackages

Submodules

tests.conftest module

pytest 配置文件 提供共享的 fixtures 和测试配置

tests.conftest.config_file_path(project_root_path)[源代码]

返回配置文件路径

tests.conftest.param_config_dir(project_root_path)[源代码]

返回参数配置目录路径

tests.conftest.project_root_path()[源代码]

返回项目根目录路径

tests.conftest.test_data_dir()[源代码]

返回测试数据目录路径

tests.test_param_updater module

测试 ParamUpdater 类

class tests.test_param_updater.TestEdgeCases[源代码]

基类:object

测试边界情况

mock_config(tmp_path)[源代码]

创建模拟配置

test_collect_validation_data_merge_varient(updater, tmp_path)[源代码]

测试合并差分参数到 Varient 列

test_generate_mappings_file_param_variable_name(updater, tmp_path)[源代码]

测试生成参数映射文件时使用正确的变量名

test_generate_mappings_file_varient_variable_name(updater, tmp_path)[源代码]

测试生成差分映射文件时使用正确的变量名

test_update_scenario_param_sheets_named_range_already_correct(updater)[源代码]

测试命名区域已经正确时不更新

updater(mock_config)[源代码]

创建更新器实例

class tests.test_param_updater.TestExceptionHandling[源代码]

基类:object

测试异常处理

mock_config(tmp_path)[源代码]

创建模拟配置

test_collect_validation_data_with_read_error(updater, tmp_path)[源代码]

测试收集验证数据时读取失败

test_collect_validation_data_with_varient_read_error(updater, tmp_path)[源代码]

测试收集验证数据时差分文件读取失败

test_generate_mappings_file_with_io_error(updater, tmp_path)[源代码]

测试生成映射文件时发生 IO 错误

test_read_param_file_with_exception(updater, tmp_path)[源代码]

测试读取参数文件时发生异常

updater(mock_config)[源代码]

创建更新器实例

class tests.test_param_updater.TestParamUpdater[源代码]

基类:object

测试 ParamUpdater 类

mock_config(tmp_path)[源代码]

创建模拟的配置对象

mock_param_excel(tmp_path)[源代码]

创建模拟的参数 Excel 文件

mock_varient_excel(tmp_path)[源代码]

创建模拟的差分参数 Excel 文件

test_collect_validation_data(updater, mock_param_excel)[源代码]

测试收集验证数据

test_collect_validation_data_empty_values(updater, tmp_path)[源代码]

测试处理空值和空字符串

test_collect_validation_data_file_not_exist(updater, tmp_path)[源代码]

测试文件不存在时的行为

test_collect_validation_data_with_varient(updater, mock_param_excel, mock_varient_excel)[源代码]

测试收集验证数据(包含差分参数)

test_generate_mappings_file(updater, tmp_path)[源代码]

测试生成映射文件

test_generate_mappings_file_varient(updater, tmp_path)[源代码]

测试生成差分映射文件

test_init(updater, mock_config)[源代码]

测试初始化

test_read_param_file_missing_columns(updater, tmp_path)[源代码]

测试缺少必需列的工作表

test_read_param_file_not_exist(updater, tmp_path)[源代码]

测试读取不存在的文件

test_read_param_file_skip_template(updater, tmp_path)[源代码]

测试跳过模板工作表

test_read_param_file_success(updater, mock_param_excel)[源代码]

测试成功读取参数文件

test_update_scenario_param_sheets_input_dir_not_exist(updater, tmp_path)[源代码]

测试输入目录不存在时的行为

test_update_scenario_param_sheets_multiple_files(updater)[源代码]

测试同时处理多个 Excel 文件

test_update_scenario_param_sheets_no_changes_needed(updater)[源代码]

测试当参数表已经是最新时的行为

test_update_scenario_param_sheets_no_excel_files(updater)[源代码]

测试没有 Excel 文件时的行为

test_update_scenario_param_sheets_no_validation_data(updater)[源代码]

测试没有验证数据时的行为

test_update_scenario_param_sheets_skip_temp_files(updater)[源代码]

测试跳过临时文件(以 ~ 开头)

test_update_scenario_param_sheets_with_named_ranges(updater)[源代码]

测试创建命名区域

test_update_scenario_param_sheets_with_param_sheet(updater)[源代码]

测试更新包含参数表的 Excel 文件

test_update_scenario_param_sheets_without_param_sheet(updater)[源代码]

测试处理没有参数表的 Excel 文件

updater(mock_config)[源代码]

创建 ParamUpdater 实例

class tests.test_param_updater.TestParamUpdaterIntegration[源代码]

基类:object

集成测试:测试完整的参数更新流程

full_setup(tmp_path)[源代码]

创建完整的测试环境

test_full_workflow(full_setup)[源代码]

测试完整的工作流程

class tests.test_param_updater.TestUpdateMappingsMethod[源代码]

基类:object

测试 update_mappings 方法

mock_config(tmp_path)[源代码]

创建模拟配置

test_update_mappings_empty_mappings(updater, tmp_path)[源代码]

测试参数文件为空时的行为

test_update_mappings_param_file_not_exist(updater)[源代码]

测试参数文件不存在时的行为

test_update_mappings_success_with_varient(updater, tmp_path)[源代码]

测试成功更新映射(有差分文件)

test_update_mappings_success_without_varient(updater, tmp_path)[源代码]

测试成功更新映射(没有差分文件)

test_update_mappings_with_scenario_param_sheets(updater, tmp_path)[源代码]

测试更新映射并更新演出表格

updater(mock_config)[源代码]

创建更新器实例

Module contents

Tests for Scenario Tool