This is initial part of testing bad input files in modulemd test-suite. It also contains some fixes found by the tests.
1 new commit added
I'll comment on code here because pagure isn't good with preserving inline comments when changes are pushed.
not document in yml
document not in yml
if ("license" in yml["data"] and isinstance(yml["data"]["license"], dict) and "content" in yml["data"]["license"]): self.content_licenses = set(yml["data"]["license"]["content"])
...should rather look like that:
Hang on, not through the code yet -- slip of the finger (clicked on "Update Issue" rather than "Preview").
TestIO:
TestIO
test_yaml()
document
yaml
if not yaml:
"could not found expected ':'"
"could not find expected ':'"
Don't put whitespace around = for keyword argument defaults/values (PEP8). E.g.:
=
def test_object_value(self, yaml = None, value = ""):
should be:
def test_object_value(self, yaml=None, value=""):
You can use a generator rather than a list comprehension if you use it only once, likewise forgo using str.find() if you only want to check for the existence of a substring here:
str.find()
yaml = "\n".join([n for n in yaml.split("\n") if n.find("$VALUE") == -1])
→
yaml = "\n".join(n for n in yaml.split("\n") if "$VALUE" not in n)
Many methods create a ModuleMetadata object mmd without ever using it.
ModuleMetadata
mmd
test_{version,release,summary,description}()
test_object_value()
test_dependencies()
I think I've addressed the issues you have found except the "could not found expected" error message. This message is generated by the Python yaml module and therefore cannot be fixed in our code.
Thanks!
Ugh. Perhaps add a comment there? Otherwise someone coming across it might want to "fix" it. You know what, make the regex r"could not f(?:ou|i)nd expected ':'" plus the comment, then we're prepared for if the issue is fixed in the yaml module.
r"could not f(?:ou|i)nd expected ':'"
I like throwing away the extra functionality in test_invalid_yaml which is never used anyway. :wink:
test_invalid_yaml
Besides that, rather than fixing stuff in a separate commit, please fix them in the commit where they're introduced (git rebase -i is your friend there, if not, poke me). We're grooming the PR, history is not yet sacrosanct. :smiley:
git rebase -i
rebased
Merged in commit bf96a45a5b50125176199ba777fdcf2c2797c9bb.
Pull-Request has been closed by nphilipp
This is initial part of testing bad input files in modulemd test-suite. It also contains some fixes found by the tests.