From a47c8afc0eb3b14a7482b884fc75dd701712bc1b Mon Sep 17 00:00:00 2001 From: Martin Kopec Date: Thu, 7 Oct 2021 09:15:55 +0200 Subject: [PATCH] Get rid of jsonschema.compat usage jsonschema.compat module is not a public interface anymore and it got removed in version > 3.2.0 The compat module was a helper for py2/3 compatibility [1]. As Tempest is full py3 now, we can rework the whole if-condition and let the timeutils to handle any wrong format. [1] https://github.com/Julian/jsonschema/blob/v3.2.0/jsonschema/compat.py Closes-Bug: #1946321 Change-Id: Ia78c19c06cfb712b1b8d0aff457fd2f91144dc07 --- tempest/lib/common/jsonschema_validator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tempest/lib/common/jsonschema_validator.py b/tempest/lib/common/jsonschema_validator.py index 0ac757d315..1618175c1c 100644 --- a/tempest/lib/common/jsonschema_validator.py +++ b/tempest/lib/common/jsonschema_validator.py @@ -31,7 +31,7 @@ FORMAT_CHECKER = jsonschema.draft4_format_checker @FORMAT_CHECKER.checks('iso8601-date-time') def _validate_datetime_format(instance): try: - if isinstance(instance, jsonschema.compat.str_types): + if instance is not None: timeutils.parse_isotime(instance) except ValueError: return False