From 85929566fd012e07051ac89cbb15f0962d464d3e Mon Sep 17 00:00:00 2001 From: Lance Bragstad Date: Wed, 24 Jan 2018 18:40:31 +0000 Subject: [PATCH] Reduce policy deprecation warnings in test runs Change-Id: I38d49c564b3ff827553a6cad9d864cd138f0e6f7 --- nova/tests/unit/policy_fixture.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nova/tests/unit/policy_fixture.py b/nova/tests/unit/policy_fixture.py index 7b614e9c7..a076afa93 100644 --- a/nova/tests/unit/policy_fixture.py +++ b/nova/tests/unit/policy_fixture.py @@ -67,7 +67,10 @@ class RealPolicyFixture(fixtures.Fixture): """ for rule in policies.list_rules(): - if rule.name not in rules: + # NOTE(lbragstad): Only write the rule if it isn't already in the + # rule set and if it isn't deprecated. Otherwise we're just going + # to spam test runs with deprecate policy warnings. + if rule.name not in rules and not rule.deprecated_for_removal: rules[rule.name] = rule.check_str