code: def run_test(src, src_expected, mock_responses):
      def patch_urlopen(url):
          package_name = re.search(
              r"https://pypi.python.org/pypi/(.+)/json", url
          ).group(1)
          return mock_responses[package_name]
  
      versions_yaml = Path("mlflow/ml-package-versions.yml")
      versions_yaml.parent.mkdir()
      versions_yaml.write_text(src)
  
      with mock.patch("urllib.request.urlopen", new=patch_urlopen):
          update_ml_package_versions.main()
  
      assert versions_yaml.read_text() == src_expected
  
file_path: mlflow/tests/dev/test_update_ml_package_versions.py
imports: import json
  import re
  from pathlib import Path
  from unittest import mock
  import pytest
  from dev import update_ml_package_versions
label_desc: Use image node_id 2 for calling a global function with example usage: run_test(src, src_expected, mock_responses) and returns: mock_responses