-
Notifications
You must be signed in to change notification settings - Fork 9
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
Repair schema-enforcer schema command #68
Conversation
- Add --schema as viable option - Make print statement print more elegantly using rich
- Validate inputs and raises an error if expected inputs don't exist - Refactor code to make intent a little more clear - Update example3 definitions
- Add logic to validate test directories exist before running unit tests - Refactor acquisition of test directory into it's own method for clarity in up stream method call - Update `schema-enforcer schema` command documentation.
- Use _get_test_dir_absolute() method in place of _get_test_dir() as test_directory is defined as a property referenced by _get_test_dir_absolute and the naming was ambiguous - Update YAMLLint
|
||
```cli | ||
bash$ schema-enforcer schema --check | ||
WARNING | Could not find expected_results_file /Users/ntc/schema_enforcer/examples/example3/schema/tests/ntp/invalid/invalid_format/results. Skipping... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feels like this should be a failure rather than a warn-and-pass case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My thought in making it a warn-case was to have the tool not hard-fail in the event that the user is in the process of developing checks (e.g. maybe populates a few different folders with a few different test cases, but either hasn't yet defined data for those or hasn't yet defined results). I can definitely toggle this so it fails though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed with Glenn I think it should be an error
Was |
Per your previous comment, I had deleted it to test something but didn't mean to commit. It's remediated :). |
This PR repairs the
schema-enforcer schema
command per #63. It also documents theschema-enforcer schema
command and it's various options.Of Note:
examples/example3/schema/definitions/properties/ip.yml
becauseformat: ipv4
wasn't correctly catching errors with an IP address. It was disabled from yamllint because, when double quoted, YAMLLint fusses about the string having an invalid escape sequence. Likewise, schema validation fails being unable to parse the string when run if it is double quoted.noqa
statements in cli.py were added to fix an incompatability between pydocstyle and click. Pydocstyle doesn't like it when a\
is used in a doc string unless the docstring is "raw" (proceeded by anr
).\f
is used in the docstring so that click only shows what proceeds the\f
in it's contextual help output to stdout. When the string is preceeded byr
, click shows the entire string in it's contextual help. I had to use a non-raw string and disable some pydocstyle particularities in order to get click to show the contextual help correctly and for pydocstyle not to fail.fixes #63