diff --git a/python/ray/serve/tests/test_constructor_failure.py b/python/ray/serve/tests/test_constructor_failure.py index 23ef14d2daa5..2faab2b6d1db 100644 --- a/python/ray/serve/tests/test_constructor_failure.py +++ b/python/ray/serve/tests/test_constructor_failure.py @@ -65,10 +65,8 @@ def __init__(self): else: with open(file_path) as f: content = f.read() - if content == serve.get_replica_context().replica_id.unique_id: - raise RuntimeError("Consistently throwing on same replica.") - else: - return True + if content == serve.get_replica_context().replica_id.unique_id: + raise RuntimeError("Consistently throwing on same replica.") async def serve(self, request): return "hi" @@ -92,11 +90,10 @@ def test_deploy_with_transient_constructor_failure(serve_instance): class TransientConstructorFailureDeployment: def __init__(self): if os.path.exists(file_path): - return True - else: - with open(file_path, "w") as f: - f.write("ONE") - raise RuntimeError("Intentionally throw on first try.") + return + with open(file_path, "w") as f: + f.write("ONE") + raise RuntimeError("Intentionally throw on first try.") async def serve(self, request): return "hi" diff --git a/python/ray/serve/tests/test_controller_recovery.py b/python/ray/serve/tests/test_controller_recovery.py index 5181a835dda8..eae85b20cad4 100644 --- a/python/ray/serve/tests/test_controller_recovery.py +++ b/python/ray/serve/tests/test_controller_recovery.py @@ -45,7 +45,7 @@ def test_recover_start_from_replica_actor_names(serve_instance, deployment_optio ) class TransientConstructorFailureDeployment: def __init__(self): - return True + pass def __call__(self, *args): return "hii"