-
-
Notifications
You must be signed in to change notification settings - Fork 611
Closed
Description
In Python 3.8, the object you pass as the spec argument to unittest.mock.Mock has its attributes iterated over. One of those attributes is DEFAULT_TYPES, which when accessed will raise jsonschema.validators._DontDoThat. This is not an issue in previous version of Python.
This will be solved by #681.
jsonschema: 3.2- Python: 3.8.3
from unittest import mock
import jsonschema
mock.Mock(spec=jsonschema.Draft7Validator)Current solution:
import sys, jsonschema
Draft7Validator = jsonschema.Draft7Validator
if sys.version_info >= (3, 8):
from importlib import metadata
if int(metadata.version("jsonschema").split(".")[0]) < 4:
class _Override(jsonschema.validators._DefaultTypesDeprecatingMetaClass):
DEFAULT_TYPES = None
class Draft7Validator(jsonschema.Draft7Validator, metaclass=_Override):
passReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels