Skip to content

Nothing checks the offline test stand-ins against the real Transport #79

Open

Description

@jonathanstokes

The offline suite cannot use a real Quad Cortex, so it replaces Transport
with stand-ins: small classes that accept the same calls and hand back canned
answers. FakeTransport in tests/test_client.py, ReplyingTransport in
tests/test_device.py, LoopbackTransport in tests/test_state.py, and two
more in tests/test_device.py and tests/test_session.py.

A stand-in only tells the truth while it accepts what the real one accepts.
Nothing checks that.

What went wrong

PR #42 added a match argument to Transport.request, gave the same argument
to three stand-ins, then dropped it from Transport again in a later round.
The stand-ins kept it. For one review cycle they accepted an argument the real
transport rejects, and two of them implemented its behaviour in full.

Nothing failed. The whole offline suite stayed green, because the only callers
were the stand-ins themselves. Had anyone written self._t.request(msg, match=...) in client.py during that window, all 2,968 offline tests would
have passed and it would have raised TypeError the first time it ran against
a unit. PR #78 removes the argument by hand.

The direction that bites is a stand-in accepting MORE than the real transport.
A stand-in accepting less fails loudly the first time a test exercises it, so
it does not need this guard.

What would hold it

A source-reading test, in the style of tests/test_hardware_markers.py and
tests/test_translation.py: walk the test modules for classes used where a
Transport is expected, compare each method they define against the same
method on protocol.transport.Transport, and fail when a stand-in accepts a
parameter the real one does not.

Two things to decide when writing it:

  • How a stand-in is recognised. Naming is not a rule today: FakeTransport,
    ReplyingTransport, LoopbackTransport, TimingOutTransport. A registry
    like BOUNDARY_MODULES in tests/test_translation.py is the repository's
    existing answer to that question, and it makes adding one deliberate.
  • Which methods are in scope. Transport has more surface than any stand-in
    implements, and a stand-in is allowed to implement a subset. Only the methods
    it does define need to agree.

A deliberate difference wants the same escape hatch the other structural tests
give: a named entry with a reason, not a blanket skip.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions