From 1b34aa2b0d46b5fd8d14cbe05f5b67f12371380c Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Sun, 28 May 2017 14:11:35 +0100 Subject: [PATCH] better file removal --- tests/__init__.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/tests/__init__.py b/tests/__init__.py index ecff5d9..397c12c 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1,20 +1,25 @@ import unittest import os -from md_pdf.consts import TEMPLATES_DIR +from md_pdf.consts import TEMPLATES_DIR, STATIC_DIR class BaseTestCase(unittest.TestCase): + def removeFile(self, file): + try: + os.remove(file) + except OSError: + pass + def deleteTemplates(self): for template in [ 'header.html', 'footer.html', 'cover.html', - 'toc-xml', + 'toc.xsl', ]: - try: - os.remove(os.path.join(TEMPLATES_DIR, template)) - except OSError: - pass + self.removeFile(os.path.join(TEMPLATES_DIR, template)) def tearDown(self): self.deleteTemplates() + self.removeFile(os.path.join(STATIC_DIR, 'style.css')) +