Beispiel #1
0
 def decorated_function(*args, **kwargs):
     call_patch = patch_object('subprocess', 'call', call_proxy)
     popen_patch = patch_object('subprocess', 'Popen', popen_proxy)
     call_sub_patch = patch_object('virtstrap.utils', 'call_subprocess', call_subprocess_proxy)
     return_value = f(*args, **kwargs)
     call_patch.restore()
     popen_patch.restore()
     call_sub_patch.restore()
     return return_value
Beispiel #2
0
 def decorated_function(*args, **kwargs):
     call_patch = patch_object('subprocess', 'call', call_proxy)
     popen_patch = patch_object('subprocess', 'Popen', popen_proxy)
     call_sub_patch = patch_object('virtstrap.utils', 'call_subprocess',
                                   call_subprocess_proxy)
     return_value = f(*args, **kwargs)
     call_patch.restore()
     popen_patch.restore()
     call_sub_patch.restore()
     return return_value
 def base_setup(self, option_overrides):
     # Create a fake VirtstrapConfig
     config = fudge.Fake()
     config.provides('from_file').returns(config)
     self.config = (config.provides('process_section').with_args(
         'project_name', arg.any()).returns('projdir'))
     # Patch VirtstrapConfig
     self.config_patch = patch_object('virtstrap.project',
                                      'VirtstrapConfig', config)
     base_parser = create_base_parser()
     options = base_parser.parse_args(args=[])
     # Add any overrides
     for name, override in option_overrides.iteritems():
         setattr(options, name, override)
     self._options = options
     self._project = None
Beispiel #4
0
 def base_setup(self, option_overrides):
     # Create a fake VirtstrapConfig
     config = fudge.Fake()
     config.provides('from_file').returns(config)
     self.config = (config.provides('process_section')
             .with_args('project_name', arg.any())
             .returns('projdir'))
     # Patch VirtstrapConfig
     self.config_patch = patch_object('virtstrap.project', 
             'VirtstrapConfig', config)
     base_parser = create_base_parser()
     options = base_parser.parse_args(args=[])
     # Add any overrides
     for name, override in option_overrides.iteritems():
         setattr(options, name, override)
     self._options = options
     self._project = None