Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions tests/unit/test_steps_prepare.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
import shutil
import tempfile
from typing import TYPE_CHECKING
from unittest.mock import MagicMock

from tmt.base.core import DependencySimple
from tmt.steps.prepare.install import PrepareInstall
from tmt.utils import Path

if TYPE_CHECKING:
from tests import RunTmt

DISABLED_CHECK_DATA = Path(__file__).resolve().parent / 'disabled_check_data'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't find this file. Did it get accidentally left out?



def test_debuginfo(root_logger):
Expand Down Expand Up @@ -35,3 +44,21 @@ def test_debuginfo(root_logger):
"grep",
"elfutils-debuginfod",
]


def test_disabled_check_skips_essential_requires(run_tmt: 'RunTmt'):
"""
Disabled check must not contribute its essential requirements
to the prepare step's package list.
"""

tmp = tempfile.mkdtemp()
result = run_tmt(
'--feeling-safe', '--root', str(DISABLED_CHECK_DATA),
'run', '-i', tmp, '-vvv',
'plan', '--name', '/disabled-only',
)
shutil.rmtree(tmp)

assert result.exit_code == 0
assert '/usr/bin/dmesg' not in result.output
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has since been changed to /bin/dmesg maybe just checking for dmesg would be better

2 changes: 2 additions & 0 deletions tmt/steps/execute/upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,8 @@ def _perform_upgrade(self, guest: tmt.guest.Guest, logger: tmt.log.Logger) -> No
required_packages += test.test_framework.get_requirements(test, self._logger)

for check in test.check:
if not check.enabled:
continue
required_packages += check.plugin.essential_requires(guest, test, self._logger)

self._install_dependencies(guest, required_packages)
Expand Down
2 changes: 2 additions & 0 deletions tmt/steps/prepare/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,8 @@ def go(self, force: bool = False) -> None:
)

for check in test.check:
if not check.enabled:
continue
collected_requires[guest].dependencies += check.plugin.essential_requires(
guest, test, self._logger
)
Expand Down
2 changes: 2 additions & 0 deletions tmt/steps/prepare/distgit.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,8 @@ def go(
collected_requires += test.test_framework.get_requirements(test, self._logger)

for check in test.check:
if not check.enabled:
continue
collected_requires += check.plugin.essential_requires(
guest, test, self._logger
Comment thread
tcornell-bus marked this conversation as resolved.
)
Expand Down
Loading