mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Fix condition for ConfigTestCase.test_datetime_config_validation
The `jsonschema` library only uses `strict_rfc3339` and not `isodate`. The test case `ConfigTestCase.test_datetime_config_validation` will fail if `isodate` is available but not `strict_rfc3339`: ``` ====================================================================== FAIL: test_datetime_config_validation (unit.utils.test_schema.ConfigTestCase) [CPU:0.0%|MEM:26.0%] ---------------------------------------------------------------------- Traceback (most recent call last): File "tests/unit/utils/test_schema.py", line 897, in test_datetime_config_validation jsonschema.validate( AssertionError: ValidationError not raised ---------------------------------------------------------------------- ``` Therefore require `strict_rfc3339` to be present for running `ConfigTestCase.test_datetime_config_validation`. fixes #55936 Signed-off-by: Benjamin Drung <benjamin.drung@cloud.ionos.com>
This commit is contained in:
parent
04ca47065e
commit
69ac5a36f9
1 changed files with 1 additions and 11 deletions
|
@ -45,13 +45,6 @@ try:
|
|||
HAS_STRICT_RFC3339 = True
|
||||
except ImportError:
|
||||
HAS_STRICT_RFC3339 = False
|
||||
|
||||
try:
|
||||
import isodate
|
||||
|
||||
HAS_ISODATE = True
|
||||
except ImportError:
|
||||
HAS_ISODATE = False
|
||||
# pylint: enable=unused-import
|
||||
|
||||
|
||||
|
@ -876,10 +869,7 @@ class ConfigTestCase(TestCase):
|
|||
)
|
||||
|
||||
@skipIf(HAS_JSONSCHEMA is False, "The 'jsonschema' library is missing")
|
||||
@skipIf(
|
||||
any([HAS_ISODATE, HAS_STRICT_RFC3339]) is False,
|
||||
"The 'strict_rfc3339' or 'isodate' library is missing",
|
||||
)
|
||||
@skipIf(not HAS_STRICT_RFC3339, "The 'strict_rfc3339' library is missing")
|
||||
def test_datetime_config_validation(self):
|
||||
class TestConf(schema.Schema):
|
||||
item = schema.DateTimeItem(title="Item", description="Item description")
|
||||
|
|
Loading…
Add table
Reference in a new issue