diff --git a/tests/conftest.py b/tests/conftest.py index 8ac1c2af7..d23451e8f 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -401,7 +401,9 @@ def pytest_collection_modifyitems(config, items): def pytest_sessionstart(session): # Remove the file at the start of the session, if it exists - if os.path.exists(SUCCESS_FILE) and os.environ["LOCAL_RANK"] == "0": + if os.path.exists(SUCCESS_FILE) and ( + os.environ.get("LOCAL_RANK", None) == "0" or os.environ.get("OMPI_COMM_WORLD_LOCAL_RANK", None) == "0" + ): os.remove(SUCCESS_FILE)