code: 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
  
file_path: pytorch-lightning/tests/tests_fabric/plugins/environments/test_lightning.py
imports: import os
  from unittest import mock
  import pytest
  from lightning.fabric.plugins.environments import LightningEnvironment
label_desc: Use image node_id 5 for calling a global function with example usage: test_random_main_port() without return types