def test_manual_main_port_and_address(tmp_path):
    """Test a user can set the port manually through the MASTER_PORT env variable."""
    environ = {
        "LSB_DJOB_RANKFILE": _make_rankfile(tmp_path),
        "LSB_JOBID": "1234",
        "JSM_NAMESPACE_SIZE": "4",
        "JSM_NAMESPACE_RANK": "3",
        "JSM_NAMESPACE_LOCAL_RANK": "1",
    }
    with mock.patch.dict(os.environ, environ), mock.patch("socket.gethostname", return_value="10.10.10.2"):
        env = LSFEnvironment()
        assert env.main_port == 10234
Test a user can set the port manually through the MASTER_PORT env variable.
tests/tests_fabric/plugins/environments/test_lsf.py