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
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@ ignore = [
"PERF203", # `try`-`except` within a loop incurs performance overhead
"D200", # One-line docstring should fit on one line
"D212", # Multi-line docstring summary should start at the first line
"TID252", # Prefer absolute imports over relative imports from parent modules

# pydocstyle
# TODO: the permanent list (drop this comment once the temporary list
Expand Down
12 changes: 6 additions & 6 deletions tmt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
'Tree',
]

from tmt.base.core import Clean, Status, Story, Test, Tree
from tmt.base.plan import Plan
from tmt.base.run import Run
from tmt.guest import Guest, GuestSsh
from tmt.log import Logger
from tmt.result import Result
from .base.core import Clean, Status, Story, Test, Tree
from .base.plan import Plan
from .base.run import Run
from .guest import Guest, GuestSsh
from .log import Logger
from .result import Result
2 changes: 1 addition & 1 deletion tmt/_compat/importlib/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from tmt._compat.importlib import metadata, readers, resources
from . import metadata, readers, resources

__all__ = [
"metadata",
Expand Down
2 changes: 1 addition & 1 deletion tmt/_compat/importlib/readers.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from importlib_resources.abc import Traversable
from importlib_resources.readers import MultiplexedPath as _MultiplexedPath

from tmt._compat.pathlib import Path
from ..pathlib import Path


class MultiplexedPath(_MultiplexedPath):
Expand Down
2 changes: 1 addition & 1 deletion tmt/_compat/pydantic.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

from pydantic import BaseModel as _BaseModel

from tmt._compat.typing import Self
from .typing import Self

class BaseModel(_BaseModel):
@classmethod
Expand Down
2 changes: 1 addition & 1 deletion tmt/_pre_commit/__main__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import re
import sys

from tmt.__main__ import run_cli
from ..__main__ import run_cli


def _run_precommit() -> None: # pyright: ignore[reportUnusedFunction] (used by project.scripts)
Expand Down
7 changes: 4 additions & 3 deletions tmt/ansible.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@

import tmt.log
import tmt.utils
from tmt._compat.pathlib import Path
from tmt.container import SerializableContainer, container, field

from ._compat.pathlib import Path
from .container import SerializableContainer, container, field

if TYPE_CHECKING:
from tmt.guest import Guest
from .guest import Guest


class _RawGuestAnsible(TypedDict, total=False):
Expand Down
6 changes: 3 additions & 3 deletions tmt/base/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Base Metadata Classes
"""

from tmt.base.core import (
from .core import (
Clean,
Core,
DependencyFile,
Expand All @@ -15,8 +15,8 @@
Test,
Tree,
)
from tmt.base.plan import Plan
from tmt.base.run import Run
from .plan import Plan
from .run import Run

__all__ = [
"Clean",
Expand Down
34 changes: 18 additions & 16 deletions tmt/base/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,20 @@
import tmt.utils
import tmt.utils.git
import tmt.utils.jira
from tmt._compat.typing import Self
from tmt.checks import Check
from tmt.container import (

from .._compat.typing import Self
from ..checks import Check
from ..container import (
SerializableContainer,
SpecBasedContainer,
container,
container_field,
container_fields,
field,
)
from tmt.lint import LinterOutcome, LinterReturn
from tmt.result import ResultInterpret
from tmt.utils import (
from ..lint import LinterOutcome, LinterReturn
from ..result import ResultInterpret
from ..utils import (
Environment,
FmfContext,
Path,
Expand All @@ -72,14 +73,15 @@
to_yaml,
verdict,
)
from tmt.utils.themes import style
from ..utils.themes import style

if TYPE_CHECKING:
from pint import Quantity

import tmt.cli
from tmt.base.plan import Plan
from tmt.base.run import Run

from .plan import Plan
from .run import Run


T = TypeVar('T')
Expand Down Expand Up @@ -2538,7 +2540,7 @@ def plans(
"""
Search available plans
"""
from tmt.base.plan import Plan
from .plan import Plan

# Handle defaults, apply possible command line options
logger = logger or (run._logger if run is not None else self._logger)
Expand Down Expand Up @@ -2720,7 +2722,7 @@ def init(*, path: Path, template: str, force: bool, logger: tmt.log.Logger) -> N
"""
Initialize a new tmt tree, optionally with a template
"""
from tmt.base.plan import Plan
from .plan import Plan

path = path.resolve()
dry = Tree._opt('dry')
Expand Down Expand Up @@ -2990,7 +2992,7 @@ def show(self) -> None:

# TODO: avoid circular import - hopefully this would disappear
# once we move `Status` into its own module.
from tmt.base.run import Run
from .run import Run

# Prepare absolute workdir path if --id was used
root_path = Path(self.workdir_root)
Expand Down Expand Up @@ -3125,7 +3127,7 @@ def guests(self, run_ids: tuple[str, ...], keep: Optional[int]) -> bool:
if self.opt('last'):
# TODO: avoid circular import - hopefully this would disappear
# once we split `Clean` into plugins
from tmt.base.run import Run
from .run import Run

# Pass the context containing --last to Run to choose
# the correct one.
Expand All @@ -3148,7 +3150,7 @@ def guests(self, run_ids: tuple[str, ...], keep: Optional[int]) -> bool:

# TODO: avoid circular import - hopefully this would disappear
# once we split `Clean` into plugins
from tmt.base.run import Run
from .run import Run

for abs_path in all_workdirs:
run = Run(
Expand Down Expand Up @@ -3188,7 +3190,7 @@ def runs(self, id_: tuple[str, ...], keep: Optional[int]) -> bool:
if self.opt('last'):
# TODO: avoid circular import - hopefully this would disappear
# once we split `Clean` into plugins
from tmt.base.run import Run
from .run import Run

# Pass the context containing --last to Run to choose
# the correct one.
Expand Down Expand Up @@ -3527,7 +3529,7 @@ def resolve_dynamic_ref(
Plan is used for context and environment expansion to process reference.
Common instance is used for appropriate logging.
"""
from tmt.base.plan import Plan
from .plan import Plan

# Nothing to do if no dynamic reference provided
if not ref or not ref.startswith("@"):
Expand Down
35 changes: 18 additions & 17 deletions tmt/base/plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,23 @@
import tmt.utils
import tmt.utils.git
import tmt.utils.jira
from tmt._compat.pathlib import Path
from tmt.base.core import (

from .._compat.pathlib import Path
from ..container import SpecBasedContainer, container, field
from ..lint import LinterOutcome, LinterReturn
from ..utils import (
Command,
Environment,
EnvVarValue,
FmfContext,
GeneralError,
HasEnvironment,
HasPlanWorkdir,
HasRunWorkdir,
style,
to_yaml,
)
from .core import (
DEFAULT_ORDER,
EXTRA_KEYS_PREFIX,
Core,
Expand All @@ -45,21 +60,7 @@
_RawLink,
expand_node_data,
)
from tmt.base.run import Run
from tmt.container import SpecBasedContainer, container, field
from tmt.lint import LinterOutcome, LinterReturn
from tmt.utils import (
Command,
Environment,
EnvVarValue,
FmfContext,
GeneralError,
HasEnvironment,
HasPlanWorkdir,
HasRunWorkdir,
style,
to_yaml,
)
from .run import Run

if TYPE_CHECKING:
import tmt.cli
Expand Down
24 changes: 13 additions & 11 deletions tmt/base/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@
import tmt.steps.scripts
import tmt.templates
import tmt.utils
from tmt.base.core import Tree
from tmt.container import (

from ..container import (
SerializableContainer,
container,
field,
)
from tmt.recipe import RecipeManager
from tmt.result import Result
from tmt.utils import (
from ..recipe import RecipeManager
from ..result import Result
from ..utils import (
Command,
Environment,
GeneralError,
Expand All @@ -47,11 +47,13 @@
StateFormat,
WorkdirArgumentType,
)
from .core import Tree

if TYPE_CHECKING:
import tmt.cli
import tmt.steps.provision.local
from tmt.base.plan import Plan

from .plan import Plan

# How many already existing lines should tmt run --follow show
FOLLOW_LINES = 10
Expand Down Expand Up @@ -260,7 +262,7 @@ def _save_tree(self, tree: Optional[Tree]) -> None:
"""
Save metadata tree, handle the default plan
"""
from tmt.base.plan import Plan
from .plan import Plan

default_plan: dict[str, Any] = tmt.utils.yaml_to_dict(
tmt.templates.MANAGER.render_default_plan()
Expand Down Expand Up @@ -400,7 +402,7 @@ def load_from_workdir(self) -> None:
clean and status only require the steps to be loaded and
their status).
"""
from tmt.base.plan import Plan
from .plan import Plan

self._save_tree(self._tree)
# with_logfiles=False: This function is currently only called by `tmt.utils.load_run`
Expand Down Expand Up @@ -439,7 +441,7 @@ def load(self) -> None:
"""
Load list of selected plans and enabled steps
"""
from tmt.base.plan import Plan
from .plan import Plan

assert self.workdir is not None # narrow type

Expand Down Expand Up @@ -516,7 +518,7 @@ def swap_plans(self, plan: "Plan", *others: "Plan") -> None:
:param plan: a plan to remove.
:param others: plans to put into the queue instead of ``plans``.
"""
from tmt.base.plan import Plan
from .plan import Plan

plans = cast(list[Plan], self.plans)
plan_queue = cast(list[Plan], self.plan_queue)
Expand Down Expand Up @@ -637,7 +639,7 @@ def go(self) -> None:
"""
Go and do test steps for selected plans
"""
from tmt.base.plan import Plan
from .plan import Plan

# Create the workdir and save last run
self._save_tree(self._tree)
Expand Down
14 changes: 8 additions & 6 deletions tmt/checks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,23 @@
import tmt.log
import tmt.utils
import tmt.utils.hints
from tmt.container import (

from ..container import (
SerializableContainer,
SpecBasedContainer,
container,
field,
key_to_option,
)
from tmt.plugins import PluginRegistry
from tmt.utils import NormalizeKeysMixin
from ..plugins import PluginRegistry
from ..utils import NormalizeKeysMixin

if TYPE_CHECKING:
import tmt.base.core
from tmt.guest import Guest
from tmt.result import CheckResult
from tmt.steps.execute import TestInvocation

from ..guest import Guest
from ..result import CheckResult
from ..steps.execute import TestInvocation


#: A type variable representing a :py:class:`Check` instances.
Expand Down
16 changes: 9 additions & 7 deletions tmt/checks/avc.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,25 @@
import tmt.log
import tmt.utils
import tmt.utils.themes
from tmt.checks import Check, CheckPlugin, _RawCheck, provides_check
from tmt.container import container, field
from tmt.result import CheckResult, ResultOutcome, save_failures
from tmt.utils import (

from ..container import container, field
from ..result import CheckResult, ResultOutcome, save_failures
from ..utils import (
CommandOutput,
Path,
ShellScript,
Stopwatch,
render_command_report,
safe_call,
)
from tmt.utils.hints import hints_as_notes
from ..utils.hints import hints_as_notes
from . import Check, CheckPlugin, _RawCheck, provides_check

if TYPE_CHECKING:
import tmt.base.core
from tmt.guest import Guest
from tmt.steps.execute import TestInvocation

from ..guest import Guest
from ..steps.execute import TestInvocation


class TestMethod(enum.Enum):
Expand Down
Loading
Loading