code: def test_snapshot_from_active_conda_env_when_prefix_available(
      conda_env_prefix, no_conda_env_name, conda_env
  ):
      expected_result = os.path.join(os.getcwd(), "env_snapshot.yml")
      with patch("subprocess.Popen") as popen:
          popen.return_value.wait.return_value = 0
  
          result = RuntimeEnvironmentManager().snapshot("auto_capture")
          assert result == expected_result
  
          call_args = popen.call_args[0][0]
          assert call_args is not None
          expected_cmd = "{} env export -p {} --no-builds > {}".format(
              conda_env.return_value,
              conda_env_prefix.return_value,
              expected_result,
          )
          assert call_args == expected_cmd
  
imports: from __future__ import absolute_import
  import subprocess
  import pytest
  from mock import patch, Mock
  import sys
  import shlex
  import os
  from mock.mock import MagicMock
  from sagemaker.remote_function.runtime_environment.runtime_environment_manager import RuntimeEnvironmentManager, RuntimeEnvironmentError
label_desc: Use image node_id 9 for calling a global function with example usage: test_snapshot_from_active_conda_env_when_prefix_available(conda_env_prefix, no_conda_env_name, conda_env) without return types