Skip to content

refactor: move the shopping tests and fixtures into shopping/ (file moves only) (RFC #520, 2/3) - #121

Merged
damaz91 merged 3 commits into
Universal-Commerce-Protocol:mainfrom
segiodongo:split/2-move-shopping-tests
Nov 10, 2026
Merged

damaz91 merged 3 commits into
Universal-Commerce-Protocol:mainfrom
segiodongo:split/2-move-shopping-tests

Conversation

@segiodongo

@segiodongo segiodongo commented Oct 30, 2026 •

Copy link
Copy Markdown
Collaborator

Second of three PRs replacing #107 (after #120). Pure git mv, no content changes in any test file — git reports every test as a 100% rename, so an open PR touching these files rebases onto the new paths without manual merges.

From To
checkout, discount, fulfillment, order, validation tests shopping/<domain>/
test_data/flower_shop/ shopping/fixtures/flower_shop/ (symlink keeps the old path)
ap2_test.py, card_credential_test.py, binding_test.py common/payments/ (binding_test.py as token_binding_test.py)
integration_test_utils.py shopping/base.py (94% copy; a facade keeps the old module importable)

The tests still import integration_test_utils; the facade re-exports every name they use, so nothing else changes until PR 3. Runner registry, CI paths, README paths and the wheel's package list follow the files.

Verification: identical results to PR 1 (77 tests, 76 passed, 1 skipped); wheel built and inspected.

…oves only)

Second step of the RFC #520 split of Universal-Commerce-Protocol#107. Every test module moves to the
package that owns it, with no content changes, so git tracks each file as
a 100% rename and open pull requests rebase onto the new paths:

- checkout, discount, fulfillment, order and validation tests go under
  `shopping/<domain>/`; `test_data/flower_shop` becomes
  `shopping/fixtures/flower_shop` (a symlink keeps the old path working).
- the payment credential tests (`ap2_test`, `card_credential_test`,
  `binding_test` as `token_binding_test`) go under `common/payments/`.

The tests still import `integration_test_utils`; the runner registry, CI
and README follow the files.
`integration_test_utils.py` becomes `shopping/base.py` (git shows it as a
94% copy because a facade keeps the old path). The facade re-exports every
name tests import from `integration_test_utils`, so the moved tests and
any open pull request keep working unchanged; it is not yet marked
deprecated because the in-tree tests still use it.

The shopping fixtures default to `shopping/fixtures/flower_shop`, and the
wheel lists the `common` and `shopping` packages instead of the former
top-level test modules.
@segiodongo
segiodongo force-pushed the split/2-move-shopping-tests branch from 1a5e21c to 0406907 Compare November 9, 2026 18:09

@niranjanmanjunath niranjanmanjunath left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@damaz91 damaz91 added status:under-review and removed status:needs-triage Signal that the PR is ready for human triage labels Nov 10, 2026
@damaz91
damaz91 merged commit 1201fb7 into Universal-Commerce-Protocol:main Nov 10, 2026
14 checks passed
vishkaty added a commit to vishkaty/conformance that referenced this pull request Nov 11, 2026
Three cases asserting that a create does not adopt or persist members the
request schema marks `omit`, and that a create without them is unaffected.

Placed as `shopping/checkout/field_ownership_test.py` and registered as
`shopping.checkout.field_ownership_test`, following the layout Universal-Commerce-Protocol#121 landed and
dropping the redundant `checkout_` prefix the way `checkout_lifecycle_test`
became `shopping.checkout.lifecycle_test`. The path and the module name are a
suggestion and easy to change.

Universal-Commerce-Protocol#120 made `SUITE_REGISTRY` the only path `--suite=all` runs, so the entry is
what makes the module execute at all: without it `--suite=all` resolves 78
cases and selects none of these three, and with it 81.

Run against the sample server from samples main: 3 passed on their own, and
81 passed for the whole suite with one skip elsewhere.
vishkaty added a commit to vishkaty/conformance that referenced this pull request Nov 11, 2026
Four cases over cart conversion: conversion uses cart contents over the
payload, a second conversion returns the existing checkout, cancel returns the
cart state before deletion, and cart discount codes carry forward.

Placed as `shopping/cart/cart_test.py` in a new `shopping/cart/` package,
following the layout Universal-Commerce-Protocol#121 landed, and registered as `shopping.cart.cart_test`.
The earlier description proposed this path once the relocation merged.

Universal-Commerce-Protocol#120 made `SUITE_REGISTRY` the only path `--suite=all` runs, so the entry is
what makes the module execute: without it `--suite=all` resolves 78 cases and
selects none of these four, and with it 82.

Run against the sample server from samples main: 4 passed.
vishkaty added a commit to vishkaty/conformance that referenced this pull request Nov 11, 2026
Seven cases over the payment terms extension, asserted against the raw wire
payload: schedule sums, term id uniqueness, selected_term_id resolution,
selection handling, and accepted_term on the order.

Placed as `common/payments/terms_test.py` and registered as
`common.payments.terms_test`, following the layout Universal-Commerce-Protocol#121 landed. Payment terms
is a common payment extension, which is why it sits beside the other payment
modules rather than under `shopping/`.

Universal-Commerce-Protocol#120 made `SUITE_REGISTRY` the only path `--suite=all` runs, so the entry is
what makes the module reachable: without it `--suite=all` selects none of
these seven.

Run against the sample server from samples main: 7 skipped, for the reason the
description gives, since nothing in the reference advertises
`dev.ucp.common.payment.terms`.
damaz91 pushed a commit that referenced this pull request Nov 12, 2026
Three cases asserting that a create does not adopt or persist members the
request schema marks `omit`, and that a create without them is unaffected.

Placed as `shopping/checkout/field_ownership_test.py` and registered as
`shopping.checkout.field_ownership_test`, following the layout #121 landed and
dropping the redundant `checkout_` prefix the way `checkout_lifecycle_test`
became `shopping.checkout.lifecycle_test`. The path and the module name are a
suggestion and easy to change.

#120 made `SUITE_REGISTRY` the only path `--suite=all` runs, so the entry is
what makes the module execute at all: without it `--suite=all` resolves 78
cases and selects none of these three, and with it 81.

Run against the sample server from samples main: 3 passed on their own, and
81 passed for the whole suite with one skip elsewhere.
aeoess added a commit to aeoess/conformance that referenced this pull request Nov 14, 2026
Rebased onto the tiered layout (Universal-Commerce-Protocol#121, Universal-Commerce-Protocol#122). The AP2 helpers and the mock
agent profile server that declares AP2 Mandates move out of the deprecated
integration_test_utils facade into common/payments/ap2_support.py, next to
the test. Ap2MandateTest keeps the requires_capability gate that main added
and still skips unless AP2 is in the negotiated capability intersection.
Test bodies and the AP2 helpers are unchanged from afcc958.

Signed-off-by: Tymofii Pidlisnyi <tima@aeoess.com>
vishkaty added a commit to vishkaty/conformance that referenced this pull request Nov 17, 2026
Four cases over cart conversion: conversion uses cart contents over the
payload, a second conversion returns the existing checkout, cancel returns the
cart state before deletion, and cart discount codes carry forward.

Placed as `shopping/cart/cart_test.py` in a new `shopping/cart/` package,
following the layout Universal-Commerce-Protocol#121 landed, and registered as `shopping.cart.cart_test`.

What makes the module execute: without the registry entry `--suite=all`
resolves 83 cases and selects none of these four, and with it 87.

Rebased onto main past Universal-Commerce-Protocol#122. The only conflict was the registry list, where
Universal-Commerce-Protocol#112 and Universal-Commerce-Protocol#122 had each added an entry. The cart entry sits at the head of the
shopping list, which keeps that list grouped by subpackage in alphabetical
order.

Obligations are cited by section name, in the module docstring and at each
case, rather than by line number. The line numbers the module carried were
correct when it was written and had since drifted, one of them onto an
unrelated paragraph, which is the hazard of citing a moving document by line.

Two cases were judging a conformant business wrongly, and both are corrected
here. The discount case used the presence of the code in the response as its
evidence that the code had applied, but a business may return a code it
received without applying it, as the reference does for an unknown code. With
a configured code that does not apply at the business under test, the case
therefore ran with nothing applied, and it failed a business that carried its
applied codes forward and dropped the unapplied one with a
`discount_code_invalid` warning, which discount.md allows. Application now
needs an applied entry naming the code or a discount in totals, so such a
code skips the case instead. Carry-forward is still satisfied by naming the
code, and a discount standing in for it must now be at least as large as the
one on the cart, so an unrelated discount no longer counts.

The contents comparison took line items as a bag of id and quantity pairs,
which failed a business expressing two units as two single-unit lines. It now
sums quantity per item id and leaves out lines naming a parent, which still
catches a business that takes its quantities from the request payload.

Verified against the flower shop reference: the module alone gives 4 passed
and 0 skipped; --suite=all gives 87 executed, 85 passed, 2 skipped, 0
failures; the pinned pre-commit, ruff, ruff format and cspell are clean. Nine
servers each breaking one obligation redden their own case and nothing else,
and the two corrections above are each held by a server that fails the old
code and passes the new one.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants