-
Notifications
You must be signed in to change notification settings - Fork 894
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Add `hypothesis` and `hypothesis-jsonschema` - Add `hypothesis-slow` tox env to run slow tests - Implement `JsonLocalResolver` to avoid `hypothesis-jsonschema` errors - Add fuzz test covering `validate_cloudconfig_schema`
- Loading branch information
Showing
6 changed files
with
131 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,7 @@ stage | |
.vscode/ | ||
htmlcov/ | ||
tags | ||
.hypothesis/ | ||
|
||
# Ignore packaging artifacts | ||
cloud-init.dsc | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
try: | ||
from hypothesis import given | ||
|
||
HAS_HYPOTHESIS = True | ||
except ImportError: | ||
HAS_HYPOTHESIS = False | ||
|
||
from unittest import mock | ||
|
||
def given(*_, **__): # type: ignore | ||
"""Dummy implementation to make pytest collection pass""" | ||
|
||
@mock.Mock # Add mock to fulfill the expected hypothesis value | ||
def run_test(item): | ||
return item | ||
|
||
return run_test | ||
|
||
|
||
__all__ = ["given", "HAS_HYPOTHESIS"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
try: | ||
from hypothesis_jsonschema import from_schema | ||
|
||
HAS_HYPOTHESIS_JSONSCHEMA = True | ||
except ImportError: | ||
HAS_HYPOTHESIS_JSONSCHEMA = False | ||
|
||
def from_schema(*_, **__): # type: ignore | ||
pass | ||
|
||
|
||
__all__ = ["from_schema", "HAS_HYPOTHESIS_JSONSCHEMA"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters