Skip to content

Commit

Permalink
Show manual test instructions in verbose mode
Browse files Browse the repository at this point in the history
Include instructions for the manual test execution in verbose mode
of the `tmt test show` command.
  • Loading branch information
psss committed Dec 19, 2024
1 parent 01d38b8 commit cbd9384
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tmt/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1339,6 +1339,24 @@ def enabled_on_guest(self, guest: tmt.steps.provision.Guest) -> bool:

return any(destination in (guest.name, guest.role) for destination in self.where)

def show_manual(self) -> None:
""" Show manual test instructions """

if self.tree is None or self.tree.root is None:
return

if self.test is None or self.test._script is None:
return

instructions_path = self.tree.root / self.test._script

try:
instructions = instructions_path.read_text()
echo(tmt.utils.format('instructions', instructions))

except FileNotFoundError:
self.warn(f"Manual test instructions file '{instructions_path}' not found.")

def show(self) -> None:
""" Show test details """
self.ls()
Expand Down Expand Up @@ -1371,6 +1389,11 @@ def show(self) -> None:
continue
if value not in [None, [], {}]:
echo(tmt.utils.format(key, value))

# Show test instructions for manual tests in verbose mode
if key == "manual" and self.manual and self.verbosity_level:
self.show_manual()

if self.verbosity_level:
self._show_additional_keys()
if self.verbosity_level >= 2:
Expand Down

0 comments on commit cbd9384

Please sign in to comment.