mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-09-08 18:57:52 +02:00
apply new linter rules
This commit is contained in:
@@ -373,7 +373,6 @@ class HttpConfig(TypedDict, total=False):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Config(TypedDict, total=False):
|
class Config(TypedDict, total=False):
|
||||||
"""Top-level config for langgraph-cli or similar deployment tooling."""
|
"""Top-level config for langgraph-cli or similar deployment tooling."""
|
||||||
|
|
||||||
|
|||||||
@@ -33,9 +33,18 @@ def test_warn_non_wolfi_distro_with_debian(capsys):
|
|||||||
warn_non_wolfi_distro(config)
|
warn_non_wolfi_distro(config)
|
||||||
|
|
||||||
captured = capsys.readouterr()
|
captured = capsys.readouterr()
|
||||||
assert "⚠️ Security Recommendation: Consider switching to Wolfi Linux for enhanced security." in captured.out
|
assert (
|
||||||
assert "Wolfi is a security-oriented, minimal Linux distribution designed for containers." in captured.out
|
"⚠️ Security Recommendation: Consider switching to Wolfi Linux for enhanced security."
|
||||||
assert 'To switch, add \'"image_distro": "wolfi"\' to your langgraph.json config file.' in captured.out
|
in captured.out
|
||||||
|
)
|
||||||
|
assert (
|
||||||
|
"Wolfi is a security-oriented, minimal Linux distribution designed for containers."
|
||||||
|
in captured.out
|
||||||
|
)
|
||||||
|
assert (
|
||||||
|
'To switch, add \'"image_distro": "wolfi"\' to your langgraph.json config file.'
|
||||||
|
in captured.out
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def test_warn_non_wolfi_distro_with_default_debian(capsys):
|
def test_warn_non_wolfi_distro_with_default_debian(capsys):
|
||||||
@@ -45,9 +54,18 @@ def test_warn_non_wolfi_distro_with_default_debian(capsys):
|
|||||||
warn_non_wolfi_distro(config)
|
warn_non_wolfi_distro(config)
|
||||||
|
|
||||||
captured = capsys.readouterr()
|
captured = capsys.readouterr()
|
||||||
assert "⚠️ Security Recommendation: Consider switching to Wolfi Linux for enhanced security." in captured.out
|
assert (
|
||||||
assert "Wolfi is a security-oriented, minimal Linux distribution designed for containers." in captured.out
|
"⚠️ Security Recommendation: Consider switching to Wolfi Linux for enhanced security."
|
||||||
assert 'To switch, add \'"image_distro": "wolfi"\' to your langgraph.json config file.' in captured.out
|
in captured.out
|
||||||
|
)
|
||||||
|
assert (
|
||||||
|
"Wolfi is a security-oriented, minimal Linux distribution designed for containers."
|
||||||
|
in captured.out
|
||||||
|
)
|
||||||
|
assert (
|
||||||
|
'To switch, add \'"image_distro": "wolfi"\' to your langgraph.json config file.'
|
||||||
|
in captured.out
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def test_warn_non_wolfi_distro_with_wolfi(capsys):
|
def test_warn_non_wolfi_distro_with_wolfi(capsys):
|
||||||
@@ -67,36 +85,51 @@ def test_warn_non_wolfi_distro_with_other_distro(capsys):
|
|||||||
warn_non_wolfi_distro(config)
|
warn_non_wolfi_distro(config)
|
||||||
|
|
||||||
captured = capsys.readouterr()
|
captured = capsys.readouterr()
|
||||||
assert "⚠️ Security Recommendation: Consider switching to Wolfi Linux for enhanced security." in captured.out
|
assert (
|
||||||
assert "Wolfi is a security-oriented, minimal Linux distribution designed for containers." in captured.out
|
"⚠️ Security Recommendation: Consider switching to Wolfi Linux for enhanced security."
|
||||||
assert 'To switch, add \'"image_distro": "wolfi"\' to your langgraph.json config file.' in captured.out
|
in captured.out
|
||||||
|
)
|
||||||
|
assert (
|
||||||
|
"Wolfi is a security-oriented, minimal Linux distribution designed for containers."
|
||||||
|
in captured.out
|
||||||
|
)
|
||||||
|
assert (
|
||||||
|
'To switch, add \'"image_distro": "wolfi"\' to your langgraph.json config file.'
|
||||||
|
in captured.out
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def test_warn_non_wolfi_distro_output_formatting():
|
def test_warn_non_wolfi_distro_output_formatting():
|
||||||
"""Test that the warning output is properly formatted with colors and empty line."""
|
"""Test that the warning output is properly formatted with colors and empty line."""
|
||||||
config = {"image_distro": "debian"}
|
config = {"image_distro": "debian"}
|
||||||
|
|
||||||
with patch('click.secho') as mock_secho:
|
with patch("click.secho") as mock_secho:
|
||||||
warn_non_wolfi_distro(config)
|
warn_non_wolfi_distro(config)
|
||||||
|
|
||||||
# Verify click.secho was called with the correct parameters
|
# Verify click.secho was called with the correct parameters
|
||||||
expected_calls = [
|
expected_calls = [
|
||||||
(
|
(
|
||||||
("⚠️ Security Recommendation: Consider switching to Wolfi Linux for enhanced security.",),
|
(
|
||||||
{"fg": "yellow", "bold": True}
|
"⚠️ Security Recommendation: Consider switching to Wolfi Linux for enhanced security.",
|
||||||
|
),
|
||||||
|
{"fg": "yellow", "bold": True},
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
(" Wolfi is a security-oriented, minimal Linux distribution designed for containers.",),
|
(
|
||||||
{"fg": "yellow"}
|
" Wolfi is a security-oriented, minimal Linux distribution designed for containers.",
|
||||||
|
),
|
||||||
|
{"fg": "yellow"},
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
(' To switch, add \'"image_distro": "wolfi"\' to your langgraph.json config file.',),
|
(
|
||||||
{"fg": "yellow"}
|
' To switch, add \'"image_distro": "wolfi"\' to your langgraph.json config file.',
|
||||||
|
),
|
||||||
|
{"fg": "yellow"},
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
("",), # Empty line
|
("",), # Empty line
|
||||||
{}
|
{},
|
||||||
)
|
),
|
||||||
]
|
]
|
||||||
|
|
||||||
assert mock_secho.call_count == 4
|
assert mock_secho.call_count == 4
|
||||||
@@ -126,7 +159,9 @@ def test_warn_non_wolfi_distro_various_configs(capsys):
|
|||||||
|
|
||||||
captured = capsys.readouterr()
|
captured = capsys.readouterr()
|
||||||
if should_warn:
|
if should_warn:
|
||||||
assert "⚠️ Security Recommendation" in captured.out, f"Should warn for {description}"
|
assert "⚠️ Security Recommendation" in captured.out, (
|
||||||
|
f"Should warn for {description}"
|
||||||
|
)
|
||||||
assert "Wolfi" in captured.out, f"Should mention Wolfi for {description}"
|
assert "Wolfi" in captured.out, f"Should mention Wolfi for {description}"
|
||||||
else:
|
else:
|
||||||
assert captured.out == "", f"Should not warn for {description}"
|
assert captured.out == "", f"Should not warn for {description}"
|
||||||
|
|||||||
Reference in New Issue
Block a user