Use a custom exception in test_control

Use of ValueError is too easily misconstrued as an actual defect in the
system under test.
pull/3046/head
Nathaniel Manista 9 years ago
parent 8c4549aec7
commit 60478685e7
  1. 10
      src/python/grpcio_test/grpc_test/framework/common/test_control.py

@ -34,6 +34,14 @@ import contextlib
import threading import threading
class Defect(Exception):
"""Simulates a programming defect raised into in a system under test.
Use of a standard exception type is too easily misconstrued as an actual
defect in either the test infrastructure or the system under test.
"""
class Control(object): class Control(object):
"""An object that accepts program control from a system under test. """An object that accepts program control from a system under test.
@ -62,7 +70,7 @@ class PauseFailControl(Control):
def control(self): def control(self):
with self._condition: with self._condition:
if self._fail: if self._fail:
raise ValueError() raise Defect()
while self._paused: while self._paused:
self._condition.wait() self._condition.wait()

Loading…
Cancel
Save