def test_repo_run_update_hooks_iterates_over_all_given_files(self): conf = Configuration(configuration={ 'repodir': '/var/repos', 'updatehooks': { 'REPO': [('file.txt', 'echo file.txt has changed')], }, }) repo = RepositoryTesting('REPO', config=conf) repo.run_update_hooks() tools.assert_equals(['echo file.txt has changed'], repo.commands)
def setUp(self): self.temp = path(tempfile.mkdtemp(prefix='test_rehab_')) self.config_file = self.temp / 'rehab_config.yml' self.data_file = self.temp / 'rehab_data.yml' self.cmd_line = ['rehab.py', 'update', '-c', self.config_file, '-d', self.data_file] with open(self.config_file, 'w') as f: f.write(CONFIG) with open(self.data_file, 'w') as f: f.write(DATA) RepositoryTesting.register() self.argv = sys.argv
def tearDown(self): sys.argv = self.argv RepositoryTesting.unregister() self.temp.rmtree()