diff --git a/changes/noissue.96.cleanup.rst b/changes/noissue.96.cleanup.rst new file mode 100644 index 00000000..00871a09 --- /dev/null +++ b/changes/noissue.96.cleanup.rst @@ -0,0 +1,3 @@ +Test: Changed unit and end2end tests to use the `firmware_feature_enabled()` +methods instead of the deprecated `feature_enabled()` methods, on Cpc and +Partition objects. diff --git a/tests/end2end/test_cpc.py b/tests/end2end/test_cpc.py index 719fabcd..d6807458 100644 --- a/tests/end2end/test_cpc.py +++ b/tests/end2end/test_cpc.py @@ -126,7 +126,6 @@ def test_cpc_features(all_cpcs): - dpm_enabled property - maximum_active_partitions property - For firmware features: - - feature_enabled() - deprecated - firmware_feature_enabled() - feature_info() - list_firmware_features() @@ -178,9 +177,7 @@ def test_cpc_features(all_cpcs): fw_feature_name = 'dpm-storage-management' if cpc_fw_features is None: # The machine does not yet support firmware features - with pytest.raises(ValueError): - # The code to be tested: feature_enabled() - cpc.feature_enabled(fw_feature_name) + # The code to be tested enabled = cpc.firmware_feature_enabled(fw_feature_name) assert enabled is False else: @@ -189,21 +186,14 @@ def test_cpc_features(all_cpcs): if not features: # The machine generally supports firmware features, but this # feature is not available - with pytest.raises(ValueError): - # The code to be tested: feature_enabled() - cpc.feature_enabled(fw_feature_name) - # The code to be tested: firmware_feature_enabled() + # The code to be tested enabled = cpc.firmware_feature_enabled(fw_feature_name) assert enabled is False else: # The machine has this feature available - # The code to be tested: feature_enabled() - enabled = cpc.feature_enabled(fw_feature_name) - exp_enabled = features[0]['state'] - assert_res_prop(enabled, exp_enabled, - 'available-features-list', cpc) - # The code to be tested: firmware_feature_enabled() + # The code to be tested enabled = cpc.firmware_feature_enabled(fw_feature_name) + exp_enabled = features[0]['state'] assert enabled == exp_enabled # Test: feature_info() if cpc_fw_features is None: diff --git a/tests/end2end/test_partition.py b/tests/end2end/test_partition.py index 7dfb21ea..484f9ac5 100644 --- a/tests/end2end/test_partition.py +++ b/tests/end2end/test_partition.py @@ -31,7 +31,7 @@ from .utils import skip_warn, pick_test_resources, TEST_PREFIX, \ standard_partition_props, runtest_find_list, runtest_get_properties, \ - pformat_as_dict, assert_res_prop, validate_firmware_features + pformat_as_dict, validate_firmware_features urllib3.disable_warnings() @@ -233,7 +233,6 @@ def test_partition_features(dpm_mode_cpcs): """ Test features of the CPC of a partition: - For firmware features: - - feature_enabled() - deprecated - firmware_feature_enabled() - feature_info() - list_firmware_features() @@ -266,9 +265,7 @@ def test_partition_features(dpm_mode_cpcs): fw_feature_name = 'dpm-storage-management' if cpc_fw_features is None: # The machine does not yet support firmware features - with pytest.raises(ValueError): - # The code to be tested: feature_enabled() - part.feature_enabled(fw_feature_name) + # The code to be tested enabled = part.firmware_feature_enabled(fw_feature_name) assert enabled is False else: @@ -292,21 +289,14 @@ def test_partition_features(dpm_mode_cpcs): if fw_feature_name not in part_state_by_name: # The machine generally supports firmware features, but this # feature is not available - with pytest.raises(ValueError): - # The code to be tested: feature_enabled() - part.feature_enabled(fw_feature_name) - # The code to be tested: firmware_feature_enabled() + # The code to be tested enabled = part.firmware_feature_enabled(fw_feature_name) assert enabled is False else: # The machine has this feature available - # The code to be tested: feature_enabled() - enabled = part.feature_enabled(fw_feature_name) - exp_enabled = part_state_by_name[fw_feature_name] - assert_res_prop(enabled, exp_enabled, - 'available-features-list', cpc) - # The code to be tested: firmware_feature_enabled() + # The code to be tested enabled = part.firmware_feature_enabled(fw_feature_name) + exp_enabled = part_state_by_name[fw_feature_name] assert enabled == exp_enabled # Test: feature_info() if cpc_fw_features is None: diff --git a/tests/end2end/utils.py b/tests/end2end/utils.py index b3d1042e..25f67334 100644 --- a/tests/end2end/utils.py +++ b/tests/end2end/utils.py @@ -574,10 +574,7 @@ def skipif_no_storage_mgmt_feature(cpc): Skip the test if the "DPM Storage Management" feature is not enabled for the specified CPC, or if the CPC does not yet support it. """ - try: - smf = cpc.feature_enabled('dpm-storage-management') - except ValueError: - smf = False + smf = cpc.firmware_feature_enabled('dpm-storage-management') if not smf: skip_warn("DPM Storage Mgmt feature not enabled or not supported " f"on CPC {cpc.name}") @@ -588,10 +585,7 @@ def skipif_storage_mgmt_feature(cpc): Skip the test if the "DPM Storage Management" feature is enabled for the specified CPC. """ - try: - smf = cpc.feature_enabled('dpm-storage-management') - except ValueError: - smf = False + smf = cpc.firmware_feature_enabled('dpm-storage-management') if smf: skip_warn(f"DPM Storage Mgmt feature enabled on CPC {cpc.name}") diff --git a/tests/unit/zhmcclient/test_cpc.py b/tests/unit/zhmcclient/test_cpc.py index 8ee6d5d3..69e72cdc 100644 --- a/tests/unit/zhmcclient/test_cpc.py +++ b/tests/unit/zhmcclient/test_cpc.py @@ -951,6 +951,9 @@ def test_cpc_list_api_features( "exp_feature_enabled, exp_exc_type, exp_exc_msg", FEATURE_ENABLED_TESTCASES ) + @pytest.mark.filterwarnings( + "ignore:.*feature_enabled.*deprecated.*:DeprecationWarning" + ) def test_cpc_feature_enabled( self, desc, cpc_name, available_features, feature_name, exp_feature_enabled, exp_exc_type, exp_exc_msg): diff --git a/tests/unit/zhmcclient/test_partition.py b/tests/unit/zhmcclient/test_partition.py index e85d2aa0..1f36c27c 100644 --- a/tests/unit/zhmcclient/test_partition.py +++ b/tests/unit/zhmcclient/test_partition.py @@ -586,6 +586,9 @@ def test_partition_delete_create_same_name(self): "exp_feature_enabled, exp_exc_type, exp_exc_msg", FEATURE_ENABLED_TESTCASES ) + @pytest.mark.filterwarnings( + "ignore:.*feature_enabled.*deprecated.*:DeprecationWarning" + ) def test_partition_feature_enabled( self, desc, partition_name, available_features, feature_name, exp_feature_enabled, exp_exc_type, exp_exc_msg):