diff --git a/tests/integration/shell/syndic.py b/tests/integration/shell/syndic.py index 4f862fd636..82de5b7381 100644 --- a/tests/integration/shell/syndic.py +++ b/tests/integration/shell/syndic.py @@ -19,6 +19,7 @@ ensure_in_syspath('../../') # Import salt libs import integration +import salt.utils class SyndicTest(integration.ShellCase, integration.ShellCaseCommonTestsMixIn): @@ -35,18 +36,18 @@ class SyndicTest(integration.ShellCase, integration.ShellCaseCommonTestsMixIn): for fname in ('master', 'minion'): pid_path = os.path.join(config_dir, '{0}.pid'.format(fname)) - config = yaml.load( - open(self.get_config_file_path(fname), 'r').read() - ) - config['log_file'] = config['syndic_log_file'] = 'file:///tmp/log/LOG_LOCAL3' - config['root_dir'] = config_dir - if 'ret_port' in config: - config['ret_port'] = int(config['ret_port']) + 10 - config['publish_port'] = int(config['publish_port']) + 10 + with salt.utils.fopen(self.get_config_file_path(fname), 'r') as fhr: + config = yaml.load(fhr.read()) + config['log_file'] = config['syndic_log_file'] = 'file:///tmp/log/LOG_LOCAL3' + config['root_dir'] = config_dir + if 'ret_port' in config: + config['ret_port'] = int(config['ret_port']) + 10 + config['publish_port'] = int(config['publish_port']) + 10 - open(os.path.join(config_dir, fname), 'w').write( - yaml.dump(config, default_flow_style=False) - ) + with salt.utils.fopen(os.path.join(config_dir, fname), 'w') as fhw: + fhw.write( + yaml.dump(config, default_flow_style=False) + ) ret = self.run_script( self._call_binary_,