mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-07 03:15:56 +00:00
- Split create-inventory logic into focused modules (cli, project, filters, host_vars, credentials, etc.) - Replace fragile path construction with python -m module execution - Add robust project root detection - Centralize password generation - Improve test coverage with per-module unit tests - Preserve existing inventory and host_vars behavior https://chatgpt.com/share/69471157-79c0-800f-8dec-25c0f8e38f03
16 lines
551 B
Python
16 lines
551 B
Python
import unittest
|
|
from unittest.mock import patch
|
|
|
|
from cli.create.inventory.subprocess_runner import run_subprocess
|
|
|
|
|
|
class TestSubprocessRunner(unittest.TestCase):
|
|
def test_run_subprocess_raises_on_nonzero(self):
|
|
with patch("cli.create.inventory.subprocess_runner.subprocess.run") as sr:
|
|
sr.return_value.returncode = 1
|
|
sr.return_value.stdout = "out"
|
|
sr.return_value.stderr = "err"
|
|
|
|
with self.assertRaises(SystemExit):
|
|
run_subprocess(["false"], capture_output=True, env=None)
|