from packaging import version

from .import_utils import is_accelerate_available


if is_accelerate_available():
      import accelerate







def 			A__  (	snake_case_ :		Optional[int]      ):
 if not is_accelerate_available():
  return method
 SCREAMING_SNAKE_CASE__:   Dict=      version.parse(accelerate.__version__      ).base_version
 if version.parse(snake_case_      ) < version.parse('''0.17.0'''      ):
  return method

 def wrapper(self :		Optional[int]       ,				*snake_case_ :		int       ,				**snake_case_ :		int      ):
  if hasattr(self       ,				'''_hf_hook'''      ) and hasattr(self._hf_hook       ,				'''pre_forward'''      ):
   self._hf_hook.pre_forward(self      )
  return method(self       ,				*snake_case_       ,				**snake_case_      )

 return wrapper


# tests directory-specific settings - this file is run automatically
# by pytest before any tests are run

import sys
import warnings
from os.path import abspath, dirname, join


# allow having multiple repository checkouts and not needing to remember to rerun
# 'pip install -e .[dev]' when switching between checkouts and running tests.
lowercase_     :   List[str] 				=				abspath(join(dirname(dirname(__file__)), 'src'))
sys.path.insert(1, git_repo_path)

# silence FutureWarning warnings in tests since often we can't act on them until
# they become normal warnings - i.e. the tests still need to test the current functionality
warnings.simplefilter(action='ignore', category=FutureWarning)







def 			A__      (	snake_case_ :		Optional[int]      ):
 from diffusers.utils.testing_utils import pytest_addoption_shared

 pytest_addoption_shared(snake_case_      )







def 			A__      (	snake_case_ :		Optional[int]      ):
 from diffusers.utils.testing_utils import pytest_terminal_summary_main

 SCREAMING_SNAKE_CASE__:   Optional[int]=      terminalreporter.config.getoption('''--make-reports'''      )
 if make_reports:
  pytest_terminal_summary_main(snake_case_       ,				id=snake_case_      )

