code: def test_public_vm_fail_on_port(self, mocker):
      mocker.patch(
          "rai_core_flask.FlaskHelper._is_local_port_available",
          return_value=False,
      )
      with pytest.raises(RuntimeError) as exception:
          FlaskHelper(ip="not localhost", with_credentials=False)
      assert (
          "Ports 8704 to 8993 not available." in exception.value.args[0]
      )
  
file_path: responsible-ai-toolbox/rai_core_flask/tests/test_environment_detector.py
imports: import os
  import pytest
  from rai_core_flask import FlaskHelper
  from rai_core_flask.environments.azure_nb_environment import AzureNBEnvironment
  from rai_core_flask.environments.credentialed_vm_environment import CredentialedVMEnvironment
  from rai_core_flask.environments.databricks_environment import DATABRICKS_ENV_VAR, DatabricksEnvironment
  from rai_core_flask.environments.local_ipython_environment import LocalIPythonEnvironment
  from rai_core_flask.environments.public_vm_environment import PublicVMEnvironment
label_desc: Use image node_id 3 for calling the TestEnvironmentDetector obj's underlying member method code with example usage: obj.test_public_vm_fail_on_port(mocker) without return types