Add test for `job_id` (#10774)

This commit is contained in:
Andres Algaba 2021-11-30 11:53:55 +01:00 committed by GitHub
parent 1d2878523a
commit e0474f8f0f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -27,6 +27,7 @@ def test_default_attributes():
assert env.creates_processes_externally
assert env.main_address == "127.0.0.1"
assert env.main_port == 12910
assert env.job_id() is None
with pytest.raises(KeyError):
# world size is required to be passed as env variable
env.world_size()
@ -55,6 +56,7 @@ def test_attributes_from_environment_variables(caplog):
assert env.auto_requeue is True
assert env.main_address == "1.1.1.1"
assert env.main_port == 15000 + 1234
assert env.job_id() == int("0001234")
assert env.world_size() == 20
assert env.global_rank() == 1
assert env.local_rank() == 2