def test_random_main_port():
    """Test randomly chosen main port when no main port was given by user."""
    env = LightningEnvironment()
    port = env.main_port
    assert isinstance(port, int)
    # repeated calls do not generate a new port number
    assert env.main_port == port
Test randomly chosen main port when no main port was given by user.
tests/tests_fabric/plugins/environments/test_lightning.py