Both test_property_protection_with_missing_operation and
test_property_protection_with_misspelt_operation rely on a bug in Python
3.9: the "]" character in a section name is not read, so section
'^[0-9]' is read as '^[0-9'. This causes _compile_rule to fail and raise
the exception the tests are expecting.
In Python 3.10, this bug has been fixed and the exception is no longer
raised. Instead, CONFIG.get() raises a NoOptionError in _load_rules,
which is not caught.
Reviewed: https:/ /review. opendev. org/c/openstack /glance/ +/825027 /opendev. org/openstack/ glance/ commit/ 800ba9645dc180f 8be4ac68e231cd7 b7c6e42716
Committed: https:/
Submitter: "Zuul (22348)"
Branch: master
commit 800ba9645dc180f 8be4ac68e231cd7 b7c6e42716
Author: Cyril Roelandt <email address hidden>
Date: Tue Jan 18 00:43:08 2022 +0100
Fix tests on Python3.10
Both test_property_ protection_ with_missing_ operation and property_ protection_ with_misspelt_ operation rely on a bug in Python
test_
3.9: the "]" character in a section name is not read, so section
'^[0-9]' is read as '^[0-9'. This causes _compile_rule to fail and raise
the exception the tests are expecting.
In Python 3.10, this bug has been fixed and the exception is no longer
raised. Instead, CONFIG.get() raises a NoOptionError in _load_rules,
which is not caught.
Closes-Bug: #1954321 0299d478ea87579 7dd1f8df17e
Change-Id: Ibce11ac002dc90