chore(deps): upgrade PyYAML to address known security vulnerability
CI / benchmark-publish (pull_request) Has been skipped
CI / push-validation (pull_request) Successful in 43s
CI / build (pull_request) Successful in 1m5s
CI / helm (pull_request) Successful in 1m7s
CI / lint (pull_request) Failing after 1m28s
CI / typecheck (pull_request) Successful in 1m58s
CI / security (pull_request) Successful in 1m58s
CI / quality (pull_request) Successful in 1m59s
CI / benchmark-regression (pull_request) Failing after 2m14s
CI / e2e_tests (pull_request) Successful in 5m58s
CI / integration_tests (pull_request) Successful in 6m41s
CI / unit_tests (pull_request) Successful in 9m15s
CI / coverage (pull_request) Has been skipped
CI / docker (pull_request) Has been skipped
CI / status-check (pull_request) Failing after 4s
CI / benchmark-publish (pull_request) Has been skipped
CI / push-validation (pull_request) Successful in 43s
CI / build (pull_request) Successful in 1m5s
CI / helm (pull_request) Successful in 1m7s
CI / lint (pull_request) Failing after 1m28s
CI / typecheck (pull_request) Successful in 1m58s
CI / security (pull_request) Successful in 1m58s
CI / quality (pull_request) Successful in 1m59s
CI / benchmark-regression (pull_request) Failing after 2m14s
CI / e2e_tests (pull_request) Successful in 5m58s
CI / integration_tests (pull_request) Successful in 6m41s
CI / unit_tests (pull_request) Successful in 9m15s
CI / coverage (pull_request) Has been skipped
CI / docker (pull_request) Has been skipped
CI / status-check (pull_request) Failing after 4s
Remove 4 duplicate Behave step definitions from security_pyyaml_dependency_steps.py
that were causing AmbiguousStep errors (already defined in tdd_a2a_sdk_dependency_steps.py).
These duplicates caused CI / lint and CI / unit_tests to fail:
- @given('the pyproject.toml file exists at "{path}"') - duplicate
- @when('I read the project dependencies from pyproject.toml') - duplicate
- @when('I attempt to import the "{module_name}" module') - duplicate
- @then('the import should succeed without errors') - duplicate
Only 3 PyYAML-specific steps and 1 helper remain unique to this file.
ISSUES CLOSED: #9055
This commit is contained in:
@@ -2,34 +2,16 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import importlib
|
||||
import re
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
import tomllib
|
||||
from behave import given, then, when
|
||||
from behave import then, when
|
||||
from behave.runner import Context
|
||||
from packaging.version import Version
|
||||
|
||||
|
||||
@given('the pyproject.toml file exists at "{path}"')
|
||||
def step_pyproject_exists(context: Context, path: str) -> None:
|
||||
"""Verify pyproject.toml exists at the given path."""
|
||||
repo_root = Path(__file__).parent.parent.parent # features/steps -> repo root
|
||||
pyproject_path = repo_root / path
|
||||
assert pyproject_path.exists(), f"pyproject.toml not found at {path}"
|
||||
context.pyproject_path = pyproject_path
|
||||
|
||||
|
||||
@when("I read the project dependencies from pyproject.toml")
|
||||
def step_read_project_dependencies(context: Context) -> None:
|
||||
"""Read the [project.dependencies] list from pyproject.toml."""
|
||||
content = context.pyproject_path.read_bytes()
|
||||
data: dict[str, Any] = _load_toml(content)
|
||||
context.project_dependencies = data.get("project", {}).get("dependencies", [])
|
||||
|
||||
|
||||
@then('the dependency list should include a package matching "{pattern}"')
|
||||
def step_dependency_matches_pattern(context: Context, pattern: str) -> None:
|
||||
"""Assert that a dependency in the project dependencies matches the given regex pattern."""
|
||||
@@ -78,24 +60,6 @@ def step_pyyaml_minimum_version(context: Context, expected: str) -> None:
|
||||
)
|
||||
|
||||
|
||||
@when('I attempt to import the "{module_name}" module')
|
||||
def step_attempt_import(context: Context, module_name: str) -> None:
|
||||
"""Attempt to import the given module and record the result."""
|
||||
try:
|
||||
context.imported_module = importlib.import_module(module_name)
|
||||
context.import_error = None
|
||||
except ImportError as exc:
|
||||
context.imported_module = None
|
||||
context.import_error = exc
|
||||
|
||||
|
||||
@then("the import should succeed without errors")
|
||||
def step_import_succeeded(context: Context) -> None:
|
||||
"""Assert that the previous import attempt succeeded."""
|
||||
assert context.import_error is None, f"Import failed with: {context.import_error}"
|
||||
assert context.imported_module is not None, "Module was not imported"
|
||||
|
||||
|
||||
def _load_toml(content: bytes) -> dict[str, Any]:
|
||||
"""Load a TOML file from bytes using the stdlib tomllib module (Python 3.11+)."""
|
||||
return tomllib.loads(content.decode("utf-8"))
|
||||
|
||||
Reference in New Issue
Block a user