Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load test specs with PyYAML instead of json #1266

Open
wants to merge 6 commits into
base: 3.x
Choose a base branch
from

Conversation

taliaferro
Copy link
Contributor

YAML provides a number of advantages over JSON for this application. It supports comments, which could make it easier to communicate what a test is doing and why, and it also allows multiline strings, which makes it much easier to write fact tests (which currently must transform their output into an array of strings, one per line).

YAML is a superset of JSON (valid JSON is also valid YAML) so nearly all the existing tests can be carried forward with no changes. (A few did contain inconsistent use of tabs and spaces for indentation -- JSON allows this but YAML does not so these tests were corrected in commit 1361068).
However, I have also converted the tests for the ZFS facts and operations to YAML for demonstration purposes, and as an example of how future tests could be written.

YAML is a superset of JSON, so most of the existing tests still parse correctly
this way, switching to YAML for future tests provides additional flexibility
(e.g. multiline strings, comments, more permissive about commas and quotes.)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant