1111# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212# See the License for the specific language governing permissions and
1313# limitations under the License.
14+ from __future__ import annotations
15+
1416from dataclasses import dataclass
17+ from textwrap import dedent
1518
1619from uses_services .platform_rules import Platform
1720
@@ -35,7 +38,9 @@ class ServiceSpecificMessages:
3538class ServiceMissingError (Exception ):
3639 """Error raised when a test uses a service but that service is missing."""
3740
38- def __init__ (self , service , platform : Platform , instructions = "" , msg = None ):
41+ def __init__ (
42+ self , service : str , platform : Platform , instructions : str = "" , msg = None
43+ ):
3944 if msg is None :
4045 msg = f"The { service } service does not seem to be running or is not accessible!"
4146 if instructions :
@@ -46,9 +51,9 @@ def __init__(self, service, platform: Platform, instructions="", msg=None):
4651 self .instructions = instructions
4752
4853 @classmethod
49- def generate_instructions (
54+ def generate (
5055 cls , platform : Platform , messages : ServiceSpecificMessages
51- ):
56+ ) -> ServiceMissingError :
5257 service = messages .service
5358
5459 supported = False
@@ -154,4 +159,9 @@ def generate_instructions(
154159 and start { service } . Good luck!
155160 """
156161 )
157- return instructions
162+
163+ return cls (
164+ service = service ,
165+ platform = platform ,
166+ instructions = instructions ,
167+ )
0 commit comments