show pytest parameterize

pull/394/head
jiaruifang 2022-03-08 11:51:32 +08:00 committed by Frank Lee
parent 11bddb6e55
commit dec24561cf
1 changed files with 3 additions and 3 deletions

View File

@ -33,11 +33,11 @@ def run_dist(rank, world_size, port):
@pytest.mark.dist @pytest.mark.dist
def test_zero_init_context(): @pytest.mark.parametrize("world_size", [1, 2, 4])
world_size = 2 def test_zero_init_context(world_size):
run_func = partial(run_dist, world_size=world_size, port=free_port()) run_func = partial(run_dist, world_size=world_size, port=free_port())
mp.spawn(run_func, nprocs=world_size) mp.spawn(run_func, nprocs=world_size)
if __name__ == '__main__': if __name__ == '__main__':
test_zero_init_context() test_zero_init_context(2)