managercommands.py 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. # Copyright (c) Twisted Matrix Laboratories.
  2. # See LICENSE for details.
  3. """
  4. Commands for reporting test success of failure to the manager.
  5. @since: 12.3
  6. """
  7. from twisted.protocols.amp import Command, String, Boolean, ListOf, Unicode
  8. from twisted.python.compat import _PY3
  9. NativeString = Unicode if _PY3 else String
  10. class AddSuccess(Command):
  11. """
  12. Add a success.
  13. """
  14. arguments = [(b'testName', NativeString())]
  15. response = [(b'success', Boolean())]
  16. class AddError(Command):
  17. """
  18. Add an error.
  19. """
  20. arguments = [(b'testName', NativeString()),
  21. (b'error', NativeString()),
  22. (b'errorClass', NativeString()),
  23. (b'frames', ListOf(NativeString()))]
  24. response = [(b'success', Boolean())]
  25. class AddFailure(Command):
  26. """
  27. Add a failure.
  28. """
  29. arguments = [(b'testName', NativeString()),
  30. (b'fail', NativeString()),
  31. (b'failClass', NativeString()),
  32. (b'frames', ListOf(NativeString()))]
  33. response = [(b'success', Boolean())]
  34. class AddSkip(Command):
  35. """
  36. Add a skip.
  37. """
  38. arguments = [(b'testName', NativeString()),
  39. (b'reason', NativeString())]
  40. response = [(b'success', Boolean())]
  41. class AddExpectedFailure(Command):
  42. """
  43. Add an expected failure.
  44. """
  45. arguments = [(b'testName', NativeString()),
  46. (b'error', NativeString()),
  47. (b'todo', NativeString())]
  48. response = [(b'success', Boolean())]
  49. class AddUnexpectedSuccess(Command):
  50. """
  51. Add an unexpected success.
  52. """
  53. arguments = [(b'testName', NativeString()),
  54. (b'todo', NativeString())]
  55. response = [(b'success', Boolean())]
  56. class TestWrite(Command):
  57. """
  58. Write test log.
  59. """
  60. arguments = [(b'out', NativeString())]
  61. response = [(b'success', Boolean())]