Move sort_name to `cocotb.RunningTest`
This method relies on an attribute which is defined in `RunningTest.__init__`, so raises `AttributeError` if called on a normal RunningCoroutine anyway
@@ -214,11 +214,6 @@ class RunningCoroutine(object):
__bool__ = __nonzero__
- def sort_name(self):
- if self.stage is None:
- return "%s.%s" % (self.module, self.funcname)
- else:
- return "%s.%d.%s" % (self.module, self.stage, self.funcname)
class RunningTest(RunningCoroutine):
"""Add some useful Test functionality to a RunningCoroutine."""
@@ -281,6 +276,12 @@ class RunningTest(RunningCoroutine):
"""
return self._force_outcome(outcomes.Error(exc))
+ def sort_name(self):
+ if self.stage is None:
+ return "%s.%s" % (self.module, self.funcname)
+ else:
+ return "%s.%d.%s" % (self.module, self.stage, self.funcname)
+
class coroutine(object):
"""Decorator class that allows us to provide common coroutine mechanisms:
