code: def test_gather_sources_and_dependencies(
      discover_sources, expected_sources
  ):
      from tests.dependency_example import some_func
      from sacred import SETTINGS
  
      SETTINGS.DISCOVER_SOURCES = discover_sources
  
      main, sources, deps = gather_sources_and_dependencies(
          some_func.__globals__, save_git_info=False
      )
      assert isinstance(main, Source)
      assert isinstance(sources, set)
      assert isinstance(deps, set)
      assert main == Source.create(
          os.path.join(TEST_DIRECTORY, "dependency_example.py")
      )
      assert sources == expected_sources
  
      assert PackageDependency.create(pytest) in deps
      assert PackageDependency.create(mock) in deps
      # If numpy is installed on the test system it will automatically be added
      # as an additional dependency, so test for that:
      if opt.has_numpy:
          assert PackageDependency.create(opt.np) in deps
          assert len(deps) == 3
      else:
          assert len(deps) == 2
  
      # Reset to default to prevent side-effects
      SETTINGS.DISCOVER_SOURCES = "imported"
  
imports: import os.path
  import os
  from pathlib import Path
  import mock
  import pytest
  from sacred.dependencies import PEP440_VERSION_PATTERN, PackageDependency, Source, gather_sources_and_dependencies, get_digest, get_py_file_if_possible, is_local_source
  import sacred.optional
label_desc: Use image node_id 17 for calling a global function with example usage: test_gather_sources_and_dependencies(discover_sources, expected_sources) without return types