Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions changes/noissue.96.cleanup.rst
Original file line number Diff line number Diff line change
@@ -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.
18 changes: 4 additions & 14 deletions tests/end2end/test_cpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand Down
20 changes: 5 additions & 15 deletions tests/end2end/test_partition.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand Down
10 changes: 2 additions & 8 deletions tests/end2end/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand All @@ -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}")

Expand Down
3 changes: 3 additions & 0 deletions tests/unit/zhmcclient/test_cpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
3 changes: 3 additions & 0 deletions tests/unit/zhmcclient/test_partition.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down