code: def test_reuse_session(tempfile=None, mocked_auth=None):
      Providers.reset_default_providers()  # necessary for the testing below
      providers = get_test_providers(
          url_2versions_nonversioned1_ver1
      )  # to check credentials
      with swallow_outputs():
          providers.download(
              url_2versions_nonversioned1_ver1, path=tempfile
          )
      assert_equal(mocked_auth.call_count, 1)
  
      providers2 = Providers.from_config_files()
      with swallow_outputs():
          providers2.download(
              url_2versions_nonversioned1_ver2,
              path=tempfile,
              overwrite=True,
          )
      assert_equal(mocked_auth.call_count, 1)
  
      # but if we reload -- everything reloads and we need to authenticate again
      providers2 = Providers.from_config_files(reload=True)
      with swallow_outputs():
          providers2.download(
              url_2versions_nonversioned1_ver2,
              path=tempfile,
              overwrite=True,
          )
      assert_equal(mocked_auth.call_count, 2)
  
      Providers.reset_default_providers()
  
imports: import os
  from unittest.mock import patch
  import pytest
  from ...downloaders.base import DownloadError
  from ...support import path
  from ...support.exceptions import AccessDeniedError
  from ...tests.utils_pytest import SkipTest, assert_equal, assert_raises, integration, skip_if_no_module, skip_if_no_network, swallow_outputs, turtle, use_cassette, with_tempfile, with_testsui
  from ...utils import md5sum
  from ..providers import Providers
  from ..s3 import S3Authenticator, S3Downloader
  from .test_http import check_download_external_url
  from .utils import get_test_providers
label_desc: Use image node_id 3 for calling a global function with example usage: test_reuse_session(tempfile, mocked_auth) without return types