11import os
22import pytest
33import sys
4- import unittest
54import random
65import tempfile
76import requests
@@ -123,7 +122,7 @@ def start_client_server(cluster, client_mode):
123122 return ("localhost:10003" , {"USE_RAY_CLIENT" : "1" }, PKG_DIR )
124123
125124
126- @unittest . skipIf (sys .platform == "win32" , "Fail to create temp dir." )
125+ @pytest . mark . skipif (sys .platform == "win32" , reason = "Fail to create temp dir." )
127126def test_travel ():
128127 import uuid
129128 with tempfile .TemporaryDirectory () as tmp_dir :
@@ -195,7 +194,7 @@ def handler(path):
195194"""
196195
197196
198- @unittest . skipIf (sys .platform == "win32" , "Fail to create temp dir." )
197+ @pytest . mark . skipif (sys .platform == "win32" , reason = "Fail to create temp dir." )
199198@pytest .mark .parametrize ("client_mode" , [True , False ])
200199def test_empty_working_dir (ray_start_cluster_head , client_mode ):
201200 cluster = ray_start_cluster_head
@@ -213,7 +212,7 @@ def test_empty_working_dir(ray_start_cluster_head, client_mode):
213212 assert out != "ERROR"
214213
215214
216- @unittest . skipIf (sys .platform == "win32" , "Fail to create temp dir." )
215+ @pytest . mark . skipif (sys .platform == "win32" , reason = "Fail to create temp dir." )
217216@pytest .mark .parametrize ("client_mode" , [True , False ])
218217def test_invalid_working_dir (ray_start_cluster_head , working_dir , client_mode ):
219218 cluster = ray_start_cluster_head
@@ -249,7 +248,7 @@ def test_invalid_working_dir(ray_start_cluster_head, working_dir, client_mode):
249248 assert out == "ValueError"
250249
251250
252- @unittest . skipIf (sys .platform == "win32" , "Fail to create temp dir." )
251+ @pytest . mark . skipif (sys .platform == "win32" , reason = "Fail to create temp dir." )
253252@pytest .mark .parametrize ("client_mode" , [True , False ])
254253def test_single_node (ray_start_cluster_head , working_dir , client_mode ):
255254 cluster = ray_start_cluster_head
@@ -265,7 +264,7 @@ def test_single_node(ray_start_cluster_head, working_dir, client_mode):
265264 assert len (kv ._internal_kv_list ("gcs://" )) == 0
266265
267266
268- @unittest . skipIf (sys .platform == "win32" , "Fail to create temp dir." )
267+ @pytest . mark . skipif (sys .platform == "win32" , reason = "Fail to create temp dir." )
269268@pytest .mark .parametrize ("client_mode" , [True , False ])
270269def test_two_node (two_node_cluster , working_dir , client_mode ):
271270 cluster , _ = two_node_cluster
@@ -281,7 +280,7 @@ def test_two_node(two_node_cluster, working_dir, client_mode):
281280 assert len (kv ._internal_kv_list ("gcs://" )) == 0
282281
283282
284- @unittest . skipIf (sys .platform == "win32" , "Fail to create temp dir." )
283+ @pytest . mark . skipif (sys .platform == "win32" , reason = "Fail to create temp dir." )
285284@pytest .mark .parametrize ("client_mode" , [True , False ])
286285def test_two_node_module (two_node_cluster , working_dir , client_mode ):
287286 cluster , _ = two_node_cluster
@@ -296,7 +295,7 @@ def test_two_node_module(two_node_cluster, working_dir, client_mode):
296295 assert len (list (Path (PKG_DIR ).iterdir ())) == 1
297296
298297
299- @unittest . skipIf (sys .platform == "win32" , "Fail to create temp dir." )
298+ @pytest . mark . skipif (sys .platform == "win32" , reason = "Fail to create temp dir." )
300299@pytest .mark .parametrize ("client_mode" , [True , False ])
301300def test_two_node_local_file (two_node_cluster , working_dir , client_mode ):
302301 with open (os .path .join (working_dir , "test_file" ), "w" ) as f :
@@ -317,7 +316,7 @@ def test_two_node_local_file(two_node_cluster, working_dir, client_mode):
317316 assert len (kv ._internal_kv_list ("gcs://" )) == 0
318317
319318
320- @unittest . skipIf (sys .platform == "win32" , "Fail to create temp dir." )
319+ @pytest . mark . skipif (sys .platform == "win32" , reason = "Fail to create temp dir." )
321320@pytest .mark .parametrize ("client_mode" , [True , False ])
322321def test_exclusion (ray_start_cluster_head , working_dir , client_mode ):
323322 cluster = ray_start_cluster_head
@@ -373,7 +372,7 @@ def test_exclusion(ray_start_cluster_head, working_dir, client_mode):
373372 "Test,FAILED,Test,FAILED,FAILED,Test,FAILED,FAILED"
374373
375374
376- @unittest . skipIf (sys .platform == "win32" , "Fail to create temp dir." )
375+ @pytest . mark . skipif (sys .platform == "win32" , reason = "Fail to create temp dir." )
377376@pytest .mark .parametrize ("client_mode" , [True , False ])
378377def test_exclusion_2 (ray_start_cluster_head , working_dir , client_mode ):
379378 cluster = ray_start_cluster_head
@@ -437,7 +436,7 @@ def create_file(p):
437436 "FAILED,Test,Test,FAILED,FAILED,Test,Test,FAILED,FAILED,FAILED,FAILED"
438437
439438
440- @unittest . skipIf (sys .platform == "win32" , "Fail to create temp dir." )
439+ @pytest . mark . skipif (sys .platform == "win32" , reason = "Fail to create temp dir." )
441440@pytest .mark .parametrize ("client_mode" , [True , False ])
442441def test_runtime_env_getter (ray_start_cluster_head , working_dir , client_mode ):
443442 cluster = ray_start_cluster_head
@@ -452,7 +451,7 @@ def test_runtime_env_getter(ray_start_cluster_head, working_dir, client_mode):
452451 assert out .strip ().split ()[- 1 ] == working_dir
453452
454453
455- @unittest . skipIf (sys .platform == "win32" , "Fail to create temp dir." )
454+ @pytest . mark . skipif (sys .platform == "win32" , reason = "Fail to create temp dir." )
456455@pytest .mark .parametrize ("client_mode" , [True , False ])
457456def test_two_node_uri (two_node_cluster , working_dir , client_mode ):
458457 cluster , _ = two_node_cluster
@@ -476,7 +475,7 @@ def test_two_node_uri(two_node_cluster, working_dir, client_mode):
476475 assert len (kv ._internal_kv_list ("pingcs://" )) == 1
477476
478477
479- @unittest . skipIf (sys .platform == "win32" , "Fail to create temp dir." )
478+ @pytest . mark . skipif (sys .platform == "win32" , reason = "Fail to create temp dir." )
480479@pytest .mark .parametrize ("client_mode" , [True , False ])
481480def test_regular_actors (ray_start_cluster_head , working_dir , client_mode ):
482481 cluster = ray_start_cluster_head
@@ -494,7 +493,7 @@ def test_regular_actors(ray_start_cluster_head, working_dir, client_mode):
494493 assert len (kv ._internal_kv_list ("gcs://" )) == 0
495494
496495
497- @unittest . skipIf (sys .platform == "win32" , "Fail to create temp dir." )
496+ @pytest . mark . skipif (sys .platform == "win32" , reason = "Fail to create temp dir." )
498497@pytest .mark .parametrize ("client_mode" , [True , False ])
499498def test_detached_actors (ray_start_cluster_head , working_dir , client_mode ):
500499 cluster = ray_start_cluster_head
@@ -523,7 +522,7 @@ def test_detached_actors(ray_start_cluster_head, working_dir, client_mode):
523522 assert len (kv ._internal_kv_list ("gcs://" )) == 0
524523
525524
526- @unittest . skipIf (sys .platform == "win32" , "Fail to create temp dir." )
525+ @pytest . mark . skipif (sys .platform == "win32" , reason = "Fail to create temp dir." )
527526def test_jobconfig_compatible_1 (ray_start_cluster_head , working_dir ):
528527 # start job_config=None
529528 # start job_config=something
@@ -549,7 +548,7 @@ def test_jobconfig_compatible_1(ray_start_cluster_head, working_dir):
549548 proc .wait ()
550549
551550
552- @unittest . skipIf (sys .platform == "win32" , "Fail to create temp dir." )
551+ @pytest . mark . skipif (sys .platform == "win32" , reason = "Fail to create temp dir." )
553552def test_jobconfig_compatible_2 (ray_start_cluster_head , working_dir ):
554553 # start job_config=something
555554 # start job_config=None
@@ -574,7 +573,7 @@ def test_jobconfig_compatible_2(ray_start_cluster_head, working_dir):
574573 proc .wait ()
575574
576575
577- @unittest . skipIf (sys .platform == "win32" , "Fail to create temp dir." )
576+ @pytest . mark . skipif (sys .platform == "win32" , reason = "Fail to create temp dir." )
578577def test_jobconfig_compatible_3 (ray_start_cluster_head , working_dir ):
579578 # start job_config=something
580579 # start job_config=something else
@@ -600,7 +599,7 @@ def test_jobconfig_compatible_3(ray_start_cluster_head, working_dir):
600599 assert out .strip ().split ()[- 1 ] == "OK"
601600
602601
603- @unittest . skipIf (sys .platform == "win32" , "Fail to create temp dir." )
602+ @pytest . mark . skipif (sys .platform == "win32" , reason = "Fail to create temp dir." )
604603def test_util_without_job_config (shutdown_only ):
605604 from ray .cluster_utils import Cluster
606605
@@ -636,7 +635,7 @@ def run():
636635 os .chdir (old_dir )
637636
638637
639- @unittest . skipIf (sys .platform == "win32" , "Fail to create temp dir." )
638+ @pytest . mark . skipif (sys .platform == "win32" , reason = "Fail to create temp dir." )
640639def test_init (shutdown_only ):
641640 with tempfile .TemporaryDirectory () as tmp_dir :
642641 old_dir = os .getcwd ()
0 commit comments