Esempio n. 1
0
 def test_export_calc(self):
     tempdir = tempfile.mkdtemp()
     with Print.patch() as p:
         export.func('hcurves', self.calc_id, 'csv', tempdir)
     fnames = os.listdir(tempdir)
     self.assertIn(str(fnames[0]), str(p))
     shutil.rmtree(tempdir)
Esempio n. 2
0
 def test_oqdata(self):
     # the that the environment variable OQ_DATADIR is honored
     job_ini = os.path.join(os.path.dirname(case_2.__file__), 'job_2.ini')
     tempdir = tempfile.mkdtemp()
     dbserver.ensure_on()
     with mock.patch.dict(os.environ, OQ_DATADIR=tempdir):
         job_id = run_job(job_ini, log_level='error')
         job = commonlib.logs.dbcmd('get_job', job_id)
         self.assertTrue(job.ds_calc_dir.startswith(tempdir),
                         job.ds_calc_dir)
     with Print.patch() as p:
         export.func('ruptures', job_id, 'csv', tempdir)
     self.assertIn('Exported', str(p))
     shutil.rmtree(tempdir)