Skip to content
Snippets Groups Projects
Commit d952cd3e authored by Gregory Ashton's avatar Gregory Ashton
Browse files

Add warning message (but pass) when errors are encountered in removing test directories

Closes #12
parent c896db59
Branches
Tags
No related merge requests found
...@@ -4,6 +4,7 @@ import os ...@@ -4,6 +4,7 @@ import os
import shutil import shutil
import pyfstat import pyfstat
import lalpulsar import lalpulsar
import logging
class Test(unittest.TestCase): class Test(unittest.TestCase):
...@@ -12,7 +13,11 @@ class Test(unittest.TestCase): ...@@ -12,7 +13,11 @@ class Test(unittest.TestCase):
@classmethod @classmethod
def setUpClass(self): def setUpClass(self):
if os.path.isdir(self.outdir): if os.path.isdir(self.outdir):
try:
shutil.rmtree(self.outdir) shutil.rmtree(self.outdir)
except OSError:
logging.warning(
"{} not removed prior to tests".format(self.outdir))
h0 = 1 h0 = 1
sqrtSX = 1 sqrtSX = 1
F0 = 30 F0 = 30
...@@ -38,7 +43,11 @@ class Test(unittest.TestCase): ...@@ -38,7 +43,11 @@ class Test(unittest.TestCase):
@classmethod @classmethod
def tearDownClass(self): def tearDownClass(self):
if os.path.isdir(self.outdir): if os.path.isdir(self.outdir):
try:
shutil.rmtree(self.outdir) shutil.rmtree(self.outdir)
except OSError:
logging.warning(
"{} not removed prior to tests".format(self.outdir))
class Writer(Test): class Writer(Test):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment