


"""simple docstring"""

import inspect
import os
import sys
import unittest

import accelerate
from accelerate.test_utils import execute_subprocess_async, require_tpu





class  lowerCamelCase__    (		unittest.TestCase     ):
      def SCREAMING_SNAKE_CASE_						(		self						:						Optional[int]				):






       '''simple docstring'''


       __lowercase						=						inspect.getfile(accelerate.test_utils				)
       __lowercase						=						os.path.sep.join(mod_file.split(os.path.sep				)[:-1] + ["""scripts""", """test_script.py"""]				)
       __lowercase						=						os.path.sep.join(inspect.getfile(self.__class__				).split(os.path.sep				)[:-1]				)






      @require_tpu
      def SCREAMING_SNAKE_CASE_						(		self						:						Optional[int]				):






       '''simple docstring'''


       __lowercase						=						F'''
            {self.test_dir}/xla_spawn.py
            --num_cores 8
            {self.test_file_path}
        '''.split()
       __lowercase						=						[sys.executable] + distributed_args
       execute_subprocess_async(A_   ,							env=os.environ.copy()				)




"""simple docstring"""

import pytest
import requests

from datasets.utils.file_utils import http_head

from .utils import OfflineSimulationMode, RequestWouldHangIndefinitelyError, offline


@pytest.mark.integration
def lowerCAmelCase_   (					):






 """simple docstring"""







 with offline(OfflineSimulationMode.CONNECTION_TIMES_OUT			):
  with pytest.raises(UpperCamelCase__			):
   requests.request("""GET"""					, """https://huggingface.co"""			)
  with pytest.raises(requests.exceptions.ConnectTimeout			):
   requests.request("""GET"""					, """https://huggingface.co"""					, timeout=1.0			)


@pytest.mark.integration
def lowerCAmelCase_   (					):






 """simple docstring"""







 with offline(OfflineSimulationMode.CONNECTION_FAILS			):
  with pytest.raises(requests.exceptions.ConnectionError			):
   requests.request("""GET"""					, """https://huggingface.co"""			)


def lowerCAmelCase_   (					):






 """simple docstring"""







 with offline(OfflineSimulationMode.HF_DATASETS_OFFLINE_SET_TO_1			):
  with pytest.raises(UpperCamelCase__			):
   http_head("""https://huggingface.co"""			)
