From: Daan De Meyer Date: Thu, 8 Feb 2024 09:28:12 +0000 (+0100) Subject: Add --debug-shell option to pytest X-Git-Tag: v21~72^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=55bed2bad98b68bfae1c7b397003479588196751;p=thirdparty%2Fmkosi.git Add --debug-shell option to pytest --- diff --git a/tests/__init__.py b/tests/__init__.py index 659e817ea..16a5a7141 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -21,6 +21,7 @@ class Image: distribution: Distribution release: str tools_tree_distribution: Optional[Distribution] + debug_shell: bool def __init__(self, config: Config, options: Sequence[PathString] = []) -> None: self.options = options @@ -86,7 +87,7 @@ class Image: def build(self, options: Sequence[str] = (), args: Sequence[str] = ()) -> CompletedProcess: return self.mkosi( "build", - [*options, "--debug", "--force"], + [*options, "--debug", "--force", *(["--debug-shell"] if self.config.debug_shell else [])], args, stdin=sys.stdin if sys.stdin.isatty() else None, user=INVOKING_USER.uid, diff --git a/tests/conftest.py b/tests/conftest.py index f93787843..641dfedf6 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -33,6 +33,11 @@ def pytest_addoption(parser: Any) -> None: type=Distribution, choices=[Distribution(d) for d in Distribution.values()], ) + parser.addoption( + "--debug-shell", + help="Pass --debug-shell when running mkosi", + action="store_true", + ) @pytest.fixture(scope="session") @@ -43,4 +48,5 @@ def config(request: Any) -> Image.Config: distribution=distribution, release=release, tools_tree_distribution=cast(Distribution, request.config.getoption("--tools-tree-distribution")), + debug_shell=request.config.getoption("--debug-shell"), )