Skip to content

Commit

Permalink
Fix missing f-string in the tmt lint check
Browse files Browse the repository at this point in the history
Instead of the key name `key "{bad_property}" not recognized` was
printed to the user when an invalid key was present in the step
phase configuration.
  • Loading branch information
psss committed Sep 20, 2024
1 parent 94f2573 commit e8c6e02
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions tests/lint/plan/data/invalid-plugin-key.fmf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
prepare:
how: feature
wrong: key
execute:
how: tmt
4 changes: 4 additions & 0 deletions tests/lint/plan/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ rlJournalStart
rlAssertGrep "fail P001 unknown key \"discove\" is used" $rlRun_LOG
rlAssertGrep "fail P001 unknown key \"environmen\" is used" $rlRun_LOG
rlAssertGrep "fail P001 unknown key \"summaryABCDEF\" is used" $rlRun_LOG

rlRun -s "$tmt plan lint invalid-plugin-key" 1
rlAssertGrep 'warn C000 key "wrong" not recognized by schema$' $rlRun_LOG
rlAssertGrep 'warn C000 key "wrong" not recognized by schema /schemas/prepare/feature' $rlRun_LOG
rlPhaseEnd

rlPhaseStartTest "P007: step phases require existing guests and roles"
Expand Down
2 changes: 1 addition & 1 deletion tmt/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -939,7 +939,7 @@ def detect_unallowed_properties(error: jsonschema.ValidationError) -> LinterRetu
f'key "{bad_property}" not recognized by schema {error.schema["$id"]}'
else:
yield LinterOutcome.WARN, \
'key "{bad_property}" not recognized by schema'
f'key "{bad_property}" not recognized by schema'

# A key not recognized, but when patternProperties are allowed. In that case,
# the key is both not listed and not matching the pattern.
Expand Down

0 comments on commit e8c6e02

Please sign in to comment.