prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  `signals.TestAbortClass` does not work in `setup_test` and `on_xxxx` methods
  It is valid to abort the class at any stage of a test.
  
  E.g. If we find out in `on_fail` that a test failed due to a fatal error like snippet_client losing socket connection, it is reasonable for the test to abort all subsequent tests in the class instead of continue running and failing more tests when we know they will fail.
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `mobly/signals.py`
  Content:
  ```
  1 # Copyright 2016 Google Inc.
  2 #
  3 # Licensed under the Apache License, Version 2.0 (the "License");
  4 # you may not use this file except in compliance with the License.
  5 # You may obtain a copy of the License at
  6 #
  7 #     http://www.apache.org/licenses/LICENSE-2.0
  8 #
  9 # Unless required by applicable law or agreed to in writing, software
  10 # distributed under the License is distributed on an "AS IS" BASIS,
  11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12 # See the License for the specific language governing permissions and
  13 # limitations under the License.
  14 """This module is where all the test signal classes and related utilities live.
  15 """
  16 
  17 import functools
  18 import json
  19 
  20 
  21 class TestSignalError(Exception):
  22     """Raised when an error occurs inside a test signal."""
  23 
  24 
  25 class TestSignal(Exception):
  26     """Base class for all test result control signals. This is used to signal
  27     the result of a test.
  28 
  29     Attribute:
  30         details: A string that describes the reason for raising this signal.
  31         extras: A json-serializable data type to convey extra information about
  32             a test result.
  33     """
  34 
  35     def __init__(self, details, extras=None):
  36         super(TestSignal, self).__init__(details)
  37         self.details = str(details)
  38         try:
  39             json.dumps(extras)
  40             self.extras = extras
  41         except TypeError:
  42             raise TestSignalError('Extras must be json serializable. %s '
  43                                   'is not.' % extras)
  44 
  45     def __str__(self):
  46         return 'Details=%s, Extras=%s' % (self.details, self.extras)
  47 
  48 
  49 class TestError(TestSignal):
  50     """Raised when a test has an unexpected error."""
  51 
  52 
  53 class TestFailure(TestSignal):
  54     """Raised when a test has failed."""
  55 
  56 
  57 class TestPass(TestSignal):
  58     """Raised when a test has passed."""
  59 
  60 
  61 class TestSkip(TestSignal):
  62     """Raised when a test has been skipped."""
  63 
  64 
  65 class TestAbortClass(TestSignal):
  66     """Raised when all subsequent tests within the same test class should
  67     be aborted.
  68     """
  69 
  70 
  71 class TestAbortAll(TestSignal):
  72     """Raised when all subsequent tests should be aborted."""
  73 
  74 
  75 class ControllerError(Exception):
  76     """Raised when an error occured in controller classes."""
  77
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/mobly/signals.py b/mobly/signals.py
  --- a/mobly/signals.py
  +++ b/mobly/signals.py
  @@ -62,13 +62,18 @@
       """Raised when a test has been skipped."""
   
   
  -class TestAbortClass(TestSignal):
  +class TestAbortSignal(TestSignal):
  +    """Base class for abort signals.
  +    """
  +
  +
  +class TestAbortClass(TestAbortSignal):
       """Raised when all subsequent tests within the same test class should
       be aborted.
       """
   
   
  -class TestAbortAll(TestSignal):
  +class TestAbortAll(TestAbortSignal):
       """Raised when all subsequent tests should be aborted."""
  
verification_info: {"golden_diff": "diff --git a/mobly/signals.py b/mobly/signals.py\n--- a/mobly/signals.py\n+++ b/mobly/signals.py\n@@ -62,13 +62,18 @@\n     \"\"\"Raised when a test has been skipped.\"\"\"\n \n \n-class TestAbortClass(TestSignal):\n+class TestAbortSignal(TestSignal):\n+    \"\"\"Base class for abort signals.\n+    \"\"\"\n+\n+\n+class TestAbortClass(TestAbortSignal):\n     \"\"\"Raised when all subsequent tests within the same test class should\n     be aborted.\n     \"\"\"\n \n \n-class TestAbortAll(TestSignal):\n+class TestAbortAll(TestAbortSignal):\n     \"\"\"Raised when all subsequent tests should be aborted.\"\"\"\n", "issue": "`signals.TestAbortClass` does not work in `setup_test` and `on_xxxx` methods\nIt is valid to abort the class at any stage of a test.\r\n\r\nE.g. If we find out in `on_fail` that a test failed due to a fatal error like snippet_client losing socket connection, it is reasonable for the test to abort all subsequent tests in the class instead of continue running and failing more tests when we know they will fail.\n", "before_files": [{"content": "# Copyright 2016 Google Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\"\"\"This module is where all the test signal classes and related utilities live.\n\"\"\"\n\nimport functools\nimport json\n\n\nclass TestSignalError(Exception):\n    \"\"\"Raised when an error occurs inside a test signal.\"\"\"\n\n\nclass TestSignal(Exception):\n    \"\"\"Base class for all test result control signals. This is used to signal\n    the result of a test.\n\n    Attribute:\n        details: A string that describes the reason for raising this signal.\n        extras: A json-serializable data type to convey extra information about\n            a test result.\n    \"\"\"\n\n    def __init__(self, details, extras=None):\n        super(TestSignal, self).__init__(details)\n        self.details = str(details)\n        try:\n            json.dumps(extras)\n            self.extras = extras\n        except TypeError:\n            raise TestSignalError('Extras must be json serializable. %s '\n                                  'is not.' % extras)\n\n    def __str__(self):\n        return 'Details=%s, Extras=%s' % (self.details, self.extras)\n\n\nclass TestError(TestSignal):\n    \"\"\"Raised when a test has an unexpected error.\"\"\"\n\n\nclass TestFailure(TestSignal):\n    \"\"\"Raised when a test has failed.\"\"\"\n\n\nclass TestPass(TestSignal):\n    \"\"\"Raised when a test has passed.\"\"\"\n\n\nclass TestSkip(TestSignal):\n    \"\"\"Raised when a test has been skipped.\"\"\"\n\n\nclass TestAbortClass(TestSignal):\n    \"\"\"Raised when all subsequent tests within the same test class should\n    be aborted.\n    \"\"\"\n\n\nclass TestAbortAll(TestSignal):\n    \"\"\"Raised when all subsequent tests should be aborted.\"\"\"\n\n\nclass ControllerError(Exception):\n    \"\"\"Raised when an error occured in controller classes.\"\"\"\n", "path": "mobly/signals.py"}], "after_files": [{"content": "# Copyright 2016 Google Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\"\"\"This module is where all the test signal classes and related utilities live.\n\"\"\"\n\nimport functools\nimport json\n\n\nclass TestSignalError(Exception):\n    \"\"\"Raised when an error occurs inside a test signal.\"\"\"\n\n\nclass TestSignal(Exception):\n    \"\"\"Base class for all test result control signals. This is used to signal\n    the result of a test.\n\n    Attribute:\n        details: A string that describes the reason for raising this signal.\n        extras: A json-serializable data type to convey extra information about\n            a test result.\n    \"\"\"\n\n    def __init__(self, details, extras=None):\n        super(TestSignal, self).__init__(details)\n        self.details = str(details)\n        try:\n            json.dumps(extras)\n            self.extras = extras\n        except TypeError:\n            raise TestSignalError('Extras must be json serializable. %s '\n                                  'is not.' % extras)\n\n    def __str__(self):\n        return 'Details=%s, Extras=%s' % (self.details, self.extras)\n\n\nclass TestError(TestSignal):\n    \"\"\"Raised when a test has an unexpected error.\"\"\"\n\n\nclass TestFailure(TestSignal):\n    \"\"\"Raised when a test has failed.\"\"\"\n\n\nclass TestPass(TestSignal):\n    \"\"\"Raised when a test has passed.\"\"\"\n\n\nclass TestSkip(TestSignal):\n    \"\"\"Raised when a test has been skipped.\"\"\"\n\n\nclass TestAbortSignal(TestSignal):\n    \"\"\"Base class for abort signals.\n    \"\"\"\n\n\nclass TestAbortClass(TestAbortSignal):\n    \"\"\"Raised when all subsequent tests within the same test class should\n    be aborted.\n    \"\"\"\n\n\nclass TestAbortAll(TestAbortSignal):\n    \"\"\"Raised when all subsequent tests should be aborted.\"\"\"\n\n\nclass ControllerError(Exception):\n    \"\"\"Raised when an error occured in controller classes.\"\"\"\n", "path": "mobly/signals.py"}]}