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:
Brian Warner 2018-02-22 09:42:43 -08:00
parent 7e22949b70
commit 9cb763e83a
13 changed files with 16 additions and 16 deletions

View File

@ -10,7 +10,7 @@ from . import _interfaces
class Allocator(object):
_timing = attrib(validator=provides(_interfaces.ITiming))
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):
self._RC = _interfaces.IRendezvousConnector(rendezvous_connector)

View File

@ -37,7 +37,7 @@ class Boss(object):
_tor = attrib(validator=optional(provides(_interfaces.ITorManager)))
_timing = attrib(validator=provides(_interfaces.ITiming))
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):
self._build_workers()

View File

@ -21,7 +21,7 @@ def first(outputs):
class Code(object):
_timing = attrib(validator=provides(_interfaces.ITiming))
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):
self._B = _interfaces.IBoss(boss)

View File

@ -19,7 +19,7 @@ def first(outputs):
class Input(object):
_timing = attrib(validator=provides(_interfaces.ITiming))
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):
self._all_nameplates = set()
@ -30,7 +30,7 @@ class Input(object):
def set_debug(self, f):
self._trace = f
def _debug(self, what):
def _debug(self, what): # pragma: no cover
if self._trace:
self._trace(old_state="", input=what, new_state="")

View File

@ -64,7 +64,7 @@ class Key(object):
_side = attrib(validator=instance_of(type(u"")))
_timing = attrib(validator=provides(_interfaces.ITiming))
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):
self._SK = _SortedKey(self._appid, self._versions, self._side,
@ -115,7 +115,7 @@ class _SortedKey(object):
_side = attrib(validator=instance_of(type(u"")))
_timing = attrib(validator=provides(_interfaces.ITiming))
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):
self._B = _interfaces.IBoss(boss)

View File

@ -10,7 +10,7 @@ from . import _interfaces
class Lister(object):
_timing = attrib(validator=provides(_interfaces.ITiming))
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):
self._RC = _interfaces.IRendezvousConnector(rendezvous_connector)

View File

@ -10,7 +10,7 @@ from . import _interfaces
class Mailbox(object):
_side = attrib(validator=instance_of(type(u"")))
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):
self._mailbox = None

View File

@ -15,7 +15,7 @@ def validate_nameplate(nameplate):
@implementer(_interfaces.INameplate)
class Nameplate(object):
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):
self._nameplate = None

View File

@ -11,7 +11,7 @@ class Order(object):
_side = attrib(validator=instance_of(type(u"")))
_timing = attrib(validator=provides(_interfaces.ITiming))
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):
self._key = None

View File

@ -12,7 +12,7 @@ class Receive(object):
_side = attrib(validator=instance_of(type(u"")))
_timing = attrib(validator=provides(_interfaces.ITiming))
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):
self._key = None

View File

@ -14,7 +14,7 @@ from .errors import KeyFormatError, AlreadyInputNameplateError
errf = None
# uncomment this to enable tab-completion debugging
#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:
print(*args, file=errf, **kwargs)
errf.flush()

View File

@ -12,7 +12,7 @@ class Send(object):
_side = attrib(validator=instance_of(type(u"")))
_timing = attrib(validator=provides(_interfaces.ITiming))
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):
self._queue = []

View File

@ -6,7 +6,7 @@ from . import _interfaces
@implementer(_interfaces.ITerminator)
class Terminator(object):
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):
self._mood = None
@ -24,7 +24,7 @@ class Terminator(object):
# TODO: rename o to 0, "" to 1. "S1" is special/terminal
# so S0nm/S0n/S0m/S0, S1nm/S1n/S1m/(S1)
# We start in Snmo (non-closing). When both nameplate and mailboxes are
# done, and we're closing, then we stop the RendezvousConnector