add "pragma: no cover" to set_trace() and debug code
we've got some tests to exercise this, so it shouldn't bitrot completely, but there are some branches-not-taken warnings that I think are spurious
This commit is contained in:
parent
7e22949b70
commit
9cb763e83a
|
@ -10,7 +10,7 @@ from . import _interfaces
|
||||||
class Allocator(object):
|
class Allocator(object):
|
||||||
_timing = attrib(validator=provides(_interfaces.ITiming))
|
_timing = attrib(validator=provides(_interfaces.ITiming))
|
||||||
m = MethodicalMachine()
|
m = MethodicalMachine()
|
||||||
set_trace = getattr(m, "_setTrace", lambda self, f: None)
|
set_trace = getattr(m, "_setTrace", lambda self, f: None) # pragma: no cover
|
||||||
|
|
||||||
def wire(self, rendezvous_connector, code):
|
def wire(self, rendezvous_connector, code):
|
||||||
self._RC = _interfaces.IRendezvousConnector(rendezvous_connector)
|
self._RC = _interfaces.IRendezvousConnector(rendezvous_connector)
|
||||||
|
|
|
@ -37,7 +37,7 @@ class Boss(object):
|
||||||
_tor = attrib(validator=optional(provides(_interfaces.ITorManager)))
|
_tor = attrib(validator=optional(provides(_interfaces.ITorManager)))
|
||||||
_timing = attrib(validator=provides(_interfaces.ITiming))
|
_timing = attrib(validator=provides(_interfaces.ITiming))
|
||||||
m = MethodicalMachine()
|
m = MethodicalMachine()
|
||||||
set_trace = getattr(m, "_setTrace", lambda self, f: None)
|
set_trace = getattr(m, "_setTrace", lambda self, f: None) # pragma: no cover
|
||||||
|
|
||||||
def __attrs_post_init__(self):
|
def __attrs_post_init__(self):
|
||||||
self._build_workers()
|
self._build_workers()
|
||||||
|
|
|
@ -21,7 +21,7 @@ def first(outputs):
|
||||||
class Code(object):
|
class Code(object):
|
||||||
_timing = attrib(validator=provides(_interfaces.ITiming))
|
_timing = attrib(validator=provides(_interfaces.ITiming))
|
||||||
m = MethodicalMachine()
|
m = MethodicalMachine()
|
||||||
set_trace = getattr(m, "_setTrace", lambda self, f: None)
|
set_trace = getattr(m, "_setTrace", lambda self, f: None) # pragma: no cover
|
||||||
|
|
||||||
def wire(self, boss, allocator, nameplate, key, input):
|
def wire(self, boss, allocator, nameplate, key, input):
|
||||||
self._B = _interfaces.IBoss(boss)
|
self._B = _interfaces.IBoss(boss)
|
||||||
|
|
|
@ -19,7 +19,7 @@ def first(outputs):
|
||||||
class Input(object):
|
class Input(object):
|
||||||
_timing = attrib(validator=provides(_interfaces.ITiming))
|
_timing = attrib(validator=provides(_interfaces.ITiming))
|
||||||
m = MethodicalMachine()
|
m = MethodicalMachine()
|
||||||
set_trace = getattr(m, "_setTrace", lambda self, f: None)
|
set_trace = getattr(m, "_setTrace", lambda self, f: None) # pragma: no cover
|
||||||
|
|
||||||
def __attrs_post_init__(self):
|
def __attrs_post_init__(self):
|
||||||
self._all_nameplates = set()
|
self._all_nameplates = set()
|
||||||
|
@ -30,7 +30,7 @@ class Input(object):
|
||||||
|
|
||||||
def set_debug(self, f):
|
def set_debug(self, f):
|
||||||
self._trace = f
|
self._trace = f
|
||||||
def _debug(self, what):
|
def _debug(self, what): # pragma: no cover
|
||||||
if self._trace:
|
if self._trace:
|
||||||
self._trace(old_state="", input=what, new_state="")
|
self._trace(old_state="", input=what, new_state="")
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@ class Key(object):
|
||||||
_side = attrib(validator=instance_of(type(u"")))
|
_side = attrib(validator=instance_of(type(u"")))
|
||||||
_timing = attrib(validator=provides(_interfaces.ITiming))
|
_timing = attrib(validator=provides(_interfaces.ITiming))
|
||||||
m = MethodicalMachine()
|
m = MethodicalMachine()
|
||||||
set_trace = getattr(m, "_setTrace", lambda self, f: None)
|
set_trace = getattr(m, "_setTrace", lambda self, f: None) # pragma: no cover
|
||||||
|
|
||||||
def __attrs_post_init__(self):
|
def __attrs_post_init__(self):
|
||||||
self._SK = _SortedKey(self._appid, self._versions, self._side,
|
self._SK = _SortedKey(self._appid, self._versions, self._side,
|
||||||
|
@ -115,7 +115,7 @@ class _SortedKey(object):
|
||||||
_side = attrib(validator=instance_of(type(u"")))
|
_side = attrib(validator=instance_of(type(u"")))
|
||||||
_timing = attrib(validator=provides(_interfaces.ITiming))
|
_timing = attrib(validator=provides(_interfaces.ITiming))
|
||||||
m = MethodicalMachine()
|
m = MethodicalMachine()
|
||||||
set_trace = getattr(m, "_setTrace", lambda self, f: None)
|
set_trace = getattr(m, "_setTrace", lambda self, f: None) # pragma: no cover
|
||||||
|
|
||||||
def wire(self, boss, mailbox, receive):
|
def wire(self, boss, mailbox, receive):
|
||||||
self._B = _interfaces.IBoss(boss)
|
self._B = _interfaces.IBoss(boss)
|
||||||
|
|
|
@ -10,7 +10,7 @@ from . import _interfaces
|
||||||
class Lister(object):
|
class Lister(object):
|
||||||
_timing = attrib(validator=provides(_interfaces.ITiming))
|
_timing = attrib(validator=provides(_interfaces.ITiming))
|
||||||
m = MethodicalMachine()
|
m = MethodicalMachine()
|
||||||
set_trace = getattr(m, "_setTrace", lambda self, f: None)
|
set_trace = getattr(m, "_setTrace", lambda self, f: None) # pragma: no cover
|
||||||
|
|
||||||
def wire(self, rendezvous_connector, input):
|
def wire(self, rendezvous_connector, input):
|
||||||
self._RC = _interfaces.IRendezvousConnector(rendezvous_connector)
|
self._RC = _interfaces.IRendezvousConnector(rendezvous_connector)
|
||||||
|
|
|
@ -10,7 +10,7 @@ from . import _interfaces
|
||||||
class Mailbox(object):
|
class Mailbox(object):
|
||||||
_side = attrib(validator=instance_of(type(u"")))
|
_side = attrib(validator=instance_of(type(u"")))
|
||||||
m = MethodicalMachine()
|
m = MethodicalMachine()
|
||||||
set_trace = getattr(m, "_setTrace", lambda self, f: None)
|
set_trace = getattr(m, "_setTrace", lambda self, f: None) # pragma: no cover
|
||||||
|
|
||||||
def __attrs_post_init__(self):
|
def __attrs_post_init__(self):
|
||||||
self._mailbox = None
|
self._mailbox = None
|
||||||
|
|
|
@ -15,7 +15,7 @@ def validate_nameplate(nameplate):
|
||||||
@implementer(_interfaces.INameplate)
|
@implementer(_interfaces.INameplate)
|
||||||
class Nameplate(object):
|
class Nameplate(object):
|
||||||
m = MethodicalMachine()
|
m = MethodicalMachine()
|
||||||
set_trace = getattr(m, "_setTrace", lambda self, f: None)
|
set_trace = getattr(m, "_setTrace", lambda self, f: None) # pragma: no cover
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self._nameplate = None
|
self._nameplate = None
|
||||||
|
|
|
@ -11,7 +11,7 @@ class Order(object):
|
||||||
_side = attrib(validator=instance_of(type(u"")))
|
_side = attrib(validator=instance_of(type(u"")))
|
||||||
_timing = attrib(validator=provides(_interfaces.ITiming))
|
_timing = attrib(validator=provides(_interfaces.ITiming))
|
||||||
m = MethodicalMachine()
|
m = MethodicalMachine()
|
||||||
set_trace = getattr(m, "_setTrace", lambda self, f: None)
|
set_trace = getattr(m, "_setTrace", lambda self, f: None) # pragma: no cover
|
||||||
|
|
||||||
def __attrs_post_init__(self):
|
def __attrs_post_init__(self):
|
||||||
self._key = None
|
self._key = None
|
||||||
|
|
|
@ -12,7 +12,7 @@ class Receive(object):
|
||||||
_side = attrib(validator=instance_of(type(u"")))
|
_side = attrib(validator=instance_of(type(u"")))
|
||||||
_timing = attrib(validator=provides(_interfaces.ITiming))
|
_timing = attrib(validator=provides(_interfaces.ITiming))
|
||||||
m = MethodicalMachine()
|
m = MethodicalMachine()
|
||||||
set_trace = getattr(m, "_setTrace", lambda self, f: None)
|
set_trace = getattr(m, "_setTrace", lambda self, f: None) # pragma: no cover
|
||||||
|
|
||||||
def __attrs_post_init__(self):
|
def __attrs_post_init__(self):
|
||||||
self._key = None
|
self._key = None
|
||||||
|
|
|
@ -14,7 +14,7 @@ from .errors import KeyFormatError, AlreadyInputNameplateError
|
||||||
errf = None
|
errf = None
|
||||||
# uncomment this to enable tab-completion debugging
|
# uncomment this to enable tab-completion debugging
|
||||||
#import os ; errf = open("err", "w") if os.path.exists("err") else None
|
#import os ; errf = open("err", "w") if os.path.exists("err") else None
|
||||||
def debug(*args, **kwargs):
|
def debug(*args, **kwargs): # pragma: no cover
|
||||||
if errf:
|
if errf:
|
||||||
print(*args, file=errf, **kwargs)
|
print(*args, file=errf, **kwargs)
|
||||||
errf.flush()
|
errf.flush()
|
||||||
|
|
|
@ -12,7 +12,7 @@ class Send(object):
|
||||||
_side = attrib(validator=instance_of(type(u"")))
|
_side = attrib(validator=instance_of(type(u"")))
|
||||||
_timing = attrib(validator=provides(_interfaces.ITiming))
|
_timing = attrib(validator=provides(_interfaces.ITiming))
|
||||||
m = MethodicalMachine()
|
m = MethodicalMachine()
|
||||||
set_trace = getattr(m, "_setTrace", lambda self, f: None)
|
set_trace = getattr(m, "_setTrace", lambda self, f: None) # pragma: no cover
|
||||||
|
|
||||||
def __attrs_post_init__(self):
|
def __attrs_post_init__(self):
|
||||||
self._queue = []
|
self._queue = []
|
||||||
|
|
|
@ -6,7 +6,7 @@ from . import _interfaces
|
||||||
@implementer(_interfaces.ITerminator)
|
@implementer(_interfaces.ITerminator)
|
||||||
class Terminator(object):
|
class Terminator(object):
|
||||||
m = MethodicalMachine()
|
m = MethodicalMachine()
|
||||||
set_trace = getattr(m, "_setTrace", lambda self, f: None)
|
set_trace = getattr(m, "_setTrace", lambda self, f: None) # pragma: no cover
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self._mood = None
|
self._mood = None
|
||||||
|
@ -24,7 +24,7 @@ class Terminator(object):
|
||||||
|
|
||||||
# TODO: rename o to 0, "" to 1. "S1" is special/terminal
|
# TODO: rename o to 0, "" to 1. "S1" is special/terminal
|
||||||
# so S0nm/S0n/S0m/S0, S1nm/S1n/S1m/(S1)
|
# so S0nm/S0n/S0m/S0, S1nm/S1n/S1m/(S1)
|
||||||
|
|
||||||
# We start in Snmo (non-closing). When both nameplate and mailboxes are
|
# We start in Snmo (non-closing). When both nameplate and mailboxes are
|
||||||
# done, and we're closing, then we stop the RendezvousConnector
|
# done, and we're closing, then we stop the RendezvousConnector
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user