def handle_copy(template_dirs, copy_config): copier = Copier(template_dirs) copier.copy_files(copy_config) copier.report() return copier.number_of_copied_files()
def test_copy_dir_recusively_with_error(reporter): test_dir = "/tmp/copy-a-directory" copier = Copier([os.path.join("tests", "fixtures")]) file_list = [{test_dir: "copier-directory-not-exist/**"}] copier.copy_files(file_list) eq_(reporter.call_count, 1)
def test_copy_files_file_not_found(self, reporter): copier = Copier([os.path.join("tests", "fixtures")]) file_list = [{"/tmp/test": "copier-test-not-found.csv"}] copier.copy_files(file_list) reporter.assert_called_with( "copier-test-not-found.csv cannot be found")
def test_number_of_files(self): copier = Copier([os.path.join("tests", "fixtures")]) file_list = [{"/tmp/test": "copier-test04.csv"}] copier.copy_files(file_list) eq_(copier.number_of_copied_files(), 1)
def test_copy_files(self, reporter): copier = Copier([os.path.join("tests", "fixtures")]) file_list = [{"/tmp/test": "copier-test01.csv"}] copier.copy_files(file_list) self.fake_copy.assert_called()