Skip to content

Commit

Permalink
squash: fixing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
happz committed Feb 12, 2024
1 parent 75ca597 commit f24006f
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 43 deletions.
2 changes: 1 addition & 1 deletion tests/core/environment-file/data/main.fmf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/test:
summary: This is a test with variables
test: python3 -m pytest -vvv -ra --showlocals -n 0 -s environment_file_data.py
test: python3 -m pytest -vvv -ra --showlocals -s environment_file_data.py

/plan:
summary: This is a plan with variables
Expand Down
2 changes: 1 addition & 1 deletion tests/core/path/main.fmf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
summary: Verify the default path handling
test: python3 -m pytest -vvv -ra --showlocals -n 0 test.py
test: python3 -m pytest -vvv -ra --showlocals test.py
framework: shell
require: python3-pytest
2 changes: 1 addition & 1 deletion tests/core/web-link/main.fmf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
summary: Check that clickable url is correctly generated
test: python3 -m pytest -vvv -ra --showlocals -n 0 test.py
test: python3 -m pytest -vvv -ra --showlocals test.py
framework: shell
require: python3-pytest
4 changes: 2 additions & 2 deletions tests/integration/main.fmf
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ tier: null
link: https:/packit/requre

/coverage-bugzilla:
test: "python3 -m pytest -vvv -ra --showlocals -n 0 -k 'test_coverage_bugzilla'"
test: "python3 -m pytest -vvv -ra --showlocals -k 'test_coverage_bugzilla'"

/the-rest:
test: "python3 -m pytest -vvv -ra --showlocals -n 0 -k 'not test_coverage_bugzilla'"
test: "python3 -m pytest -vvv -ra --showlocals -k 'not test_coverage_bugzilla'"
1 change: 1 addition & 0 deletions tests/unit/main.fmf
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ description:
framework: shell
require:
- python3-pytest
- python3-pytest-xdist
environment:
LANG: en_US.UTF-8

Expand Down
58 changes: 20 additions & 38 deletions tests/unit/test_steps_prepare.py
Original file line number Diff line number Diff line change
@@ -1,50 +1,32 @@
from unittest.mock import MagicMock, patch
from unittest.mock import MagicMock

import tmt
from tmt.log import Logger
from tmt.base import DependencySimple
from tmt.steps.prepare.install import InstallBase


def prepare_command(self):
""" Fake prepare_command() for InstallBase """
return ("command", "options")


def get(what, default=None):
""" Fake get() for parent PrepareInstall """

if what == "directory":
return []

if what == "missing":
return "skip"

if what == "package":
return [
# Regular packages
"wget",
"debuginfo-something",
"elfutils-debuginfod",
# Debuginfo packages
"grep-debuginfo",
"elfutils-debuginfod-debuginfo",
]

return None


@patch.object(tmt.steps.prepare.install.InstallBase, 'prepare_command', prepare_command)
def test_debuginfo():
def test_debuginfo(root_logger):
""" Check debuginfo package parsing """

logger = Logger.create()
parent = MagicMock()
parent.get = get
guest = MagicMock()

install = InstallBase(parent=parent, logger=logger, guest=guest)

assert install.repository_packages == [
install = InstallBase(
parent=parent,
packages=[
# Regular packages
DependencySimple("wget"),
DependencySimple("debuginfo-something"),
DependencySimple("elfutils-debuginfod"),
# Debuginfo packages
DependencySimple("grep-debuginfo"),
DependencySimple("elfutils-debuginfod-debuginfo"),
],
directories=[],
exclude=[],
logger=root_logger,
guest=guest)

assert install.packages == [
"wget",
"debuginfo-something",
"elfutils-debuginfod",
Expand Down

0 comments on commit f24006f

Please sign in to comment.