From ed94856c8f0787ce50f7d9c5a623561fe547161e Mon Sep 17 00:00:00 2001 From: Stephen Gallagher Date: Jan 31 2019 13:39:55 +0000 Subject: Fix PR tests for newly-added files. We were returning invalid data when asked to compare a file that didn't exist before this PR was filed. Return IOError to skip it and update the comments to explain why. It will still be tested by validate.py. Signed-off-by: Stephen Gallagher --- diff --git a/tests/compare_defaults.py b/tests/compare_defaults.py index b8c7fb5..5cc245e 100755 --- a/tests/compare_defaults.py +++ b/tests/compare_defaults.py @@ -22,9 +22,12 @@ def get_index_and_defaults (repo, filename, commit): yaml = repo.git.show('%s:%s' % (commit, filename)) except git.exc.GitCommandError as e: # This file didn't exist in the baseline commit, so just return - # success. If there's anything wrong with the new file, it will be - # caught in common_tests.sh - return 0 + # IOError to skip checking it. + # If there's anything wrong with the new file, it will be caught in + # common_tests.sh + raise IOError("No baseline file") + + index = Modulemd.ModuleIndex.new() try: @@ -64,11 +67,9 @@ def main(): baseline_index, baseline_defaults = get_index_and_defaults ( repo, filename, baseline_commit) except IOError as e: - # This should never happen, since the original files presumably have - # been validated previously (unless someone merged without checking - # the CI results on a PR). If this occurs, the failures will be in the - # logs and we'll assume that this PR is trying to fix it, which will - # be mostly handled in common_tests.sh. + # Either the baseline file didn't exist or was itself invalid (which + # should never happen...). In either case, there's no valid original + # to compare to. Check it only with validate.py. print(e, file=sys.stderr) return unusable_baseline()