def setUpClass(cls): """ Build a datastore instance to show what it is inside """ job_ini = os.path.join(os.path.dirname(case_1.__file__), 'job.ini') with Print.patch() as cls.p: calc = run._run([job_ini], 0, 'nojob', False, 'info', None, '', {}) cls.calc_id = calc.datastore.calc_id
def setUpClass(cls): """ Build a datastore instance to show what it is inside """ # the tests here gave mysterious core dumps in Ubuntu 16.04, # but only when called together with all other tests with the command # nosetests openquake/commonlib/ job_ini = os.path.join(os.path.dirname(case_1.__file__), 'job.ini') with Print.patch() as cls.p: calc = run._run(job_ini, 0, False, 'info', None, '', {}) cls.calc_id = calc.datastore.calc_id
def setUpClass(cls): """ Build a datastore instance to show what it is inside """ # the tests here gave mysterious core dumps in Ubuntu 16.04, # but only when called together with all other tests with the command # nosetests openquake/commonlib/ job_ini = os.path.join(os.path.dirname(case_1.__file__), 'job.ini') with Print.patch() as cls.p: calc = run._run(job_ini, 0, False, 'info', None, '', {}) cls.calc_id = calc.datastore.calc_id
def test_reduce_sm_with_duplicate_source_ids(self): # testing reduce_sm in case of two sources with the same ID and # different codes temp_dir = tempfile.mkdtemp() calc_dir = os.path.dirname(to_reduce.__file__) shutil.copytree(calc_dir, os.path.join(temp_dir, 'data')) job_ini = os.path.join(temp_dir, 'data', 'job.ini') with Print.patch(): calc = run._run([job_ini], 0, 'nojob', False, 'info', None, '', {}) calc_id = calc.datastore.calc_id with mock.patch('logging.info') as info: reduce_sm(calc_id) self.assertIn('Removed %d/%d sources', info.call_args[0][0]) shutil.rmtree(temp_dir)