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
This commit is contained in:
Martin Kopec 2021-10-07 09:15:55 +02:00
parent a7bcabc897
commit a47c8afc0e
1 changed files with 1 additions and 1 deletions

View File

@ -31,7 +31,7 @@ FORMAT_CHECKER = jsonschema.draft4_format_checker
@FORMAT_CHECKER.checks('iso8601-date-time') @FORMAT_CHECKER.checks('iso8601-date-time')
def _validate_datetime_format(instance): def _validate_datetime_format(instance):
try: try:
if isinstance(instance, jsonschema.compat.str_types): if instance is not None:
timeutils.parse_isotime(instance) timeutils.parse_isotime(instance)
except ValueError: except ValueError:
return False return False