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

Merge branch 'make-tests-more-robust' into 'master'

Make tests more robust

See merge request !21
parents e976b57c 367e4a02
Branches
Tags
1 merge request!21Make tests more robust
......@@ -31,11 +31,8 @@ def _optional_import(modulename, shorthand=None):
logging.debug("Successfully imported module %s%s." % (modulename, shorthandbit))
success = True
except ImportError as e:
if e.message == "No module named " + modulename:
logging.debug("No module {:s} found.".format(modulename))
logging.debug("Failed to import module {:s}.".format(modulename))
success = False
else:
raise
return success
......
......@@ -31,6 +31,5 @@ setup(
"bashplotlib",
"peakutils",
"pathos",
"pycuda",
],
)
......@@ -5,7 +5,7 @@ import shutil
import pyfstat
import lalpulsar
import logging
import time
class Test(unittest.TestCase):
outdir = "TestData"
......@@ -85,6 +85,7 @@ class Writer(Test):
Writer.run_makefakedata()
time_second = os.path.getmtime(Writer.sftfilepath)
self.assertTrue(time_first == time_second)
time.sleep(1) # make sure timestamp is actually different!
os.system("touch {}".format(Writer.config_file_name))
Writer.run_makefakedata()
time_third = os.path.getmtime(Writer.sftfilepath)
......@@ -550,12 +551,8 @@ class GridSearch(Test):
tref=self.tref,
Lambda0=[30, 0, 0, 0],
)
search.run()
self.assertTrue(
os.path.isfile(
"{}/{}_slice_projection.png".format(search.outdir, search.label)
)
)
fig, axes = search.run(save=False)
self.assertTrue(fig is not None)
def test_glitch_grid_search(self):
search = pyfstat.GridGlitchSearch(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment