]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Add --debug-shell option to pytest
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 8 Feb 2024 09:28:12 +0000 (10:28 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 8 Feb 2024 14:05:25 +0000 (15:05 +0100)
tests/__init__.py
tests/conftest.py

index 659e817ea2459ad1a7e28e2cb29fe82017583a0e..16a5a71417ad2ac478f0c25b34e7f9a4a5bdc76c 100644 (file)
@@ -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,
index f93787843ea875d92549edeacb8e4c04645d8e9e..641dfedf6d6b16ce4ccdabc19fecb02c405e4a74 100644 (file)
@@ -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"),
     )