From 3b0718d24d9582aa8abfa5ae370f6e22498a131e Mon Sep 17 00:00:00 2001 From: Archit Kulkarni Date: Tue, 26 Dec 2023 16:42:42 -0800 Subject: [PATCH] Check version at runtime for skipping test Signed-off-by: Archit Kulkarni --- tests/compatibility-test.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/tests/compatibility-test.py b/tests/compatibility-test.py index 68a004228e..cbf35210e2 100755 --- a/tests/compatibility-test.py +++ b/tests/compatibility-test.py @@ -150,13 +150,18 @@ def test_ray_serve(self): show_cluster_info(RayFTTestCase.ray_cluster_ns) self.fail(f"Fail to execute test_ray_serve_2.py. The exit code is {exit_code}.") - @unittest.skipIf( - ray_version == '2.8.0', - 'test_detached_actor is too flaky with Ray 2.8.0 due to https://github.com/ray-project/ray/issues/41343.' - 'However, it is fixed in Ray 2.9.0 and the nightly.' - ) def test_detached_actor(self): """Kill GCS process on the head Pod and then test a detached actor.""" + + # We must do this check here and not in a @unittest.skipIf decorator because + # the decorator is evaluated at import time, and the environment variables + # modifying the gloabl variable `ray_version` are not read until runtime. + if ray_version == '2.8.0': + raise unittest.SkipTest( + 'test_detached_actor is too flaky with Ray 2.8.0 due to' + 'https://github.com/ray-project/ray/issues/41343.' + 'It is fixed in Ray 2.9.0 and the nightly.') + headpod = get_head_pod(RayFTTestCase.ray_cluster_ns) headpod_name = headpod.metadata.name