scitex_etc.wait_key

scitex_etc.wait_key.wait_key(p, *, read_key=None, printer=<built-in function print>)[source]

Block until the user presses q, then terminate process p.

Echoes each key as it is pressed; on q prints a notice and calls p.terminate().

Parameters:
  • p – A process-like object exposing terminate().

  • read_key (callable, optional) – Zero-arg callable returning the next key as a string. Defaults to readchar.readchar. Injectable as a test seam (no mocks).

  • printer (callable, optional) – Output sink, defaults to the builtin print. Injectable so tests can record output without patching builtins.print.

scitex_etc.wait_key.count(*, printer=<built-in function print>, sleeper=<built-in function sleep>)[source]

Print an incrementing counter forever, sleeping 1s between values.

Parameters:
  • printer (callable, optional) – Output sink, defaults to the builtin print. Injectable test seam.

  • sleeper (callable, optional) – One-arg sleep callable, defaults to time.sleep. Injectable so tests can run without real delay and bound the loop.