def setUp(self): self.publication = Publication(title='Python Programming', language='en', identifier='MS1104') self.publication.items = [ Item(id='001', file='001.html', type='application/xhtml+xml'), Item(id='cover', file='cover.png', type='image/png'), Item(id='002', file='002.html', type='application/xhtml+xml') ] destination_dir = 'test' self.destination_path = os.path.join(settings.OUTPUT_DIR, destination_dir) #delete previous dir if os.path.exists(self.destination_path): shutil.rmtree(self.destination_path) self.epub_generator = EpubGenerator(destination_dir, self.publication) self.epub_generator.generate_epub()