Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
".cspell.json",
"**/*.svg",
".gitignore",
"package.json"
"package.json",
"requirements/catalog/**"
],
"dictionaryDefinitions": [
{
Expand Down
9 changes: 9 additions & 0 deletions .cspell/custom-words.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# cspell-specific custom words related to UCP
absl
absltest
addoption
adyen
Adyen
agentic
Expand All @@ -9,6 +10,7 @@ Amex
Ant
Anytown
atok
autojunk
backorder
Backordered
Braintree
Expand All @@ -32,17 +34,20 @@ flagsaver
Flipkart
fontawesome
fpan
getoption
fulfillable
Gap
GitHub
Google
gpay
Gpay
gpgsign
healthz
idless
ingestions
inlinehilite
Kroger
levelname
linenums
llmstxt
Lowe's
Expand All @@ -51,13 +56,16 @@ Malform
mastercard
Mastercard
mkdocs
modifyitems
mtok
nodeid
openapi
openrpc
Paymentech
paypal
Paypal
permissionless
pluginmanager
preorders
Preorders
proto
Expand All @@ -78,6 +86,7 @@ Smallville
Stripe
superfences
Target
terminalreporter
testpaths
UCP
Ulta
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
uv.lock
.venv
node_modules/
requirements/reports/
5 changes: 5 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ repos:
hooks:
- id: prettier
files: \.(json|md|yaml|yml)$
# requirements/tools/build_catalog.py writes the catalog, and its
# output must stay byte-identical to what the tool produces.
exclude: ^requirements/catalog/
- repo: https://github.com/koalaman/shellcheck-precommit
rev: v0.10.0
hooks:
Expand All @@ -46,3 +49,5 @@ repos:
rev: v2.4.1
hooks:
- id: codespell
# The catalog quotes the specification verbatim.
exclude: ^requirements/catalog/
34 changes: 34 additions & 0 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,41 @@

"""Configuration file for pytest."""

import pytest

from framework import marker_check
from framework.base_test import FLAGS


FLAGS(["pytest"])


def pytest_addoption(parser: pytest.Parser) -> None:
"""Add the option for the requirements check."""
parser.addoption(
"--requirements-check",
choices=marker_check.MODES,
default="strict",
help="check the shopping tests' spec markers against the requirements "
"catalog: strict stops on problems, warn only reports them, off skips the "
"check (default: strict)",
)


def pytest_collection_modifyitems(
config: pytest.Config, items: list[pytest.Item]
) -> None:
"""Check the spec markers of the collected tests, as the runner does."""
report, stop = marker_check.evaluate(
[marker_check.from_pytest_item(item) for item in items],
config.getoption("--requirements-check"),
)
reporter = config.pluginmanager.get_plugin("terminalreporter")
if report and reporter is not None:
reporter.ensure_newline()
reporter.write(report)
if stop:
raise pytest.UsageError(
"requirements check failed: fix the problems above, or pass "
"--requirements-check=warn to run anyway"
)
15 changes: 14 additions & 1 deletion framework/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,15 @@

from framework.agent_profile_server import AgentProfileServer
from framework.base_test import BaseIntegrationTest
from framework.decorators import requires_capability, spec_assert
from framework.decorators import (
no_rule,
older_version,
outside_catalog,
partly,
requires_capability,
scenario,
spec_assert,
)
Comment thread
segiodongo marked this conversation as resolved.
Resolved
from framework.discovery import Capability, UcpProfile, fetch_server_profile
from framework.mock_webhook_server import MockWebhookServer
from framework.platform import PlatformProfile, PlatformRequirement
Expand All @@ -30,6 +38,11 @@
"PlatformRequirement",
"UcpProfile",
"fetch_server_profile",
"no_rule",
"older_version",
"outside_catalog",
"partly",
"requires_capability",
"scenario",
"spec_assert",
]
Loading
Loading