Begin Firecracker microVM support
This commit is contained in:
parent
fa6af127c1
commit
ed8ad1bee9
11 changed files with 290 additions and 7 deletions
36
tests/test_dev_command_checks.py
Normal file
36
tests/test_dev_command_checks.py
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from unittest.mock import patch
|
||||
|
||||
from django.test import override_settings
|
||||
|
||||
from config.checks import check_required_dev_commands
|
||||
|
||||
|
||||
@override_settings(DEBUG=False, TESTING=False)
|
||||
def test_command_check_is_silent_in_production_runtime() -> None:
|
||||
"""Production runtime must not warn about dev-only command dependencies."""
|
||||
with patch("config.checks.shutil.which", return_value=None):
|
||||
warnings = check_required_dev_commands()
|
||||
|
||||
assert warnings == []
|
||||
|
||||
|
||||
@override_settings(DEBUG=True, TESTING=False)
|
||||
def test_command_check_warns_and_mentions_dev_only_dependencies() -> None:
|
||||
"""Dev runtime must warn and clearly label these dependencies as dev-only."""
|
||||
|
||||
def fake_which(command: str) -> str | None:
|
||||
if command == "curl":
|
||||
return None
|
||||
return f"/usr/bin/{command}"
|
||||
|
||||
with patch("config.checks.shutil.which", side_effect=fake_which):
|
||||
warnings = check_required_dev_commands()
|
||||
|
||||
assert len(warnings) == 1
|
||||
warning = warnings[0]
|
||||
assert warning.id == "tussilago.W001"
|
||||
assert warning.hint is not None
|
||||
assert "Dev-only tooling missing" in warning.hint
|
||||
assert "curl" in warning.hint
|
||||
Loading…
Add table
Add a link
Reference in a new issue