def store_files_int(*args, **kwargs): def int_dec_fn(pathname_arg, keys_arg): if not isinstance(pathname_arg, str): return if PersistentObjectStorage().do_store( keys=StoreFiles.basic_ps_keys + keys_arg): if os.path.exists(pathname_arg): cls._copy_logic( PersistentObjectStorage(), pathname=pathname_arg, keys=keys_arg, ) else: try: cls._copy_logic( PersistentObjectStorage(), pathname=pathname_arg, keys=keys_arg, ) except PersistentStorageException: pass class_test_id_list = [cls.__name__, cls._test_identifier()] output = Simple.decorator_plain(func)(*args, **kwargs) for position in range(len(args)): int_dec_fn(args[position], class_test_id_list + [position]) for k, v in kwargs.items(): int_dec_fn(v, class_test_id_list + [k]) return output
def store_files_int(*args, **kwargs): output = Simple.decorator_plain(func)(*args, **kwargs) cls._copy_logic( PersistentObjectStorage(), pathname=output, keys=[cls.__name__, cls._test_identifier()], ) return output
def store_files_int_int(*args, **kwargs): class_test_id_list = [cls.__name__, cls._test_identifier()] output = Simple.decorator_plain(func)(*args, **kwargs) for key, position in files_params.items(): if key in kwargs: param = kwargs[key] else: param = args[position] cls._copy_logic( PersistentObjectStorage(), pathname=param, keys=class_test_id_list + [key], ) return output
) from requre.helpers.tempfile import TempFile from requre.helpers.simple_object import Simple from requre.helpers.files import StoreFiles from requre.helpers.git.pushinfo import PushInfoStorageList from requre.helpers.git.fetchinfo import FetchInfoStorageList from requre.helpers.git.repo import Repo from packit.api import PackitAPI from tests_recording.testbase import PackitTest @record_requests_for_all_methods() @apply_decorator_to_all_methods( replace_module_match(what="packit.utils.run_command_remote", decorate=Simple.decorator_plain())) @apply_decorator_to_all_methods( replace_module_match( what="packit.fedpkg.FedPKG.clone", decorate=StoreFiles.where_arg_references( key_position_params_dict={"target_path": 2}), )) @apply_decorator_to_all_methods( replace_module_match( what="git.repo.base.Repo.clone_from", decorate=StoreFiles.where_arg_references( key_position_params_dict={"to_path": 2}, return_decorator=Repo.decorator_plain, ), )) @apply_decorator_to_all_methods(
from requre.import_system import upgrade_import_system from requre.helpers.git.fetchinfo import RemoteFetch FILTERS = ( upgrade_import_system().decorate( where="download_helper", what="DownloadHelper.request", who_name="lookaside_cache_helper", decorator=RequestResponseHandling.decorator_plain(), ).replace_module(where="^tempfile$", who_name="^packit", replacement=TempFile).decorate( where="^packit$", who_name="fedpkg", what="utils.run_command_remote", decorator=Simple.decorator_plain(), ).decorate( where="packit.fedpkg", what="FedPKG.clone", decorator=StoreFiles.where_arg_references( key_position_params_dict={"target_path": 2}), ).decorate( where="git", who_name="local_project", what="remote.Remote.push", decorator=PushInfoStorageList.decorator_plain(), ).decorate( where="git", who_name="local_project", what="remote.Remote.fetch", decorator=RemoteFetch.decorator_plain(),
) from requre.helpers.tempfile import TempFile from requre.helpers.simple_object import Simple from requre.helpers.files import StoreFiles from requre.helpers.git.pushinfo import PushInfoStorageList from requre.helpers.git.fetchinfo import FetchInfoStorageList from requre.helpers.git.repo import Repo from packit.api import PackitAPI from tests_recording.testbase import PackitTest @record_requests_for_all_methods() @apply_decorator_to_all_methods( replace_module_match( what="packit.utils.run_command_remote", decorate=Simple.decorator_plain() ) ) @apply_decorator_to_all_methods( replace_module_match( what="packit.fedpkg.FedPKG.clone", decorate=StoreFiles.where_arg_references( key_position_params_dict={"target_path": 2} ), ) ) @apply_decorator_to_all_methods( replace_module_match( what="git.repo.base.Repo.clone_from", decorate=StoreFiles.where_arg_references( key_position_params_dict={"to_path": 2},