def test_attributes_from_environment_variables(): """ Test that the default cluster environment takes the attributes from the environment variables. """ env = LightningEnvironment() assert env.master_address() == "1.2.3.4" assert env.master_port() == 500 assert env.world_size() is None assert env.local_rank() == 2 assert env.node_rank() == 3
def test_default_attributes(): """ Test the default attributes when no environment variables are set. """ env = LightningEnvironment() assert not env.creates_children() assert env.master_address() == "127.0.0.1" assert isinstance(env.master_port(), int) assert env.world_size() == 1 assert env.local_rank() == 0 assert env.node_rank() == 0