better file removal
This commit is contained in:
parent
b7669c53ff
commit
1b34aa2b0d
1 changed files with 11 additions and 6 deletions
|
@ -1,20 +1,25 @@
|
||||||
import unittest
|
import unittest
|
||||||
import os
|
import os
|
||||||
from md_pdf.consts import TEMPLATES_DIR
|
from md_pdf.consts import TEMPLATES_DIR, STATIC_DIR
|
||||||
|
|
||||||
|
|
||||||
class BaseTestCase(unittest.TestCase):
|
class BaseTestCase(unittest.TestCase):
|
||||||
|
def removeFile(self, file):
|
||||||
|
try:
|
||||||
|
os.remove(file)
|
||||||
|
except OSError:
|
||||||
|
pass
|
||||||
|
|
||||||
def deleteTemplates(self):
|
def deleteTemplates(self):
|
||||||
for template in [
|
for template in [
|
||||||
'header.html',
|
'header.html',
|
||||||
'footer.html',
|
'footer.html',
|
||||||
'cover.html',
|
'cover.html',
|
||||||
'toc-xml',
|
'toc.xsl',
|
||||||
]:
|
]:
|
||||||
try:
|
self.removeFile(os.path.join(TEMPLATES_DIR, template))
|
||||||
os.remove(os.path.join(TEMPLATES_DIR, template))
|
|
||||||
except OSError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
self.deleteTemplates()
|
self.deleteTemplates()
|
||||||
|
self.removeFile(os.path.join(STATIC_DIR, 'style.css'))
|
||||||
|
|
||||||
|
|
Reference in a new issue