def test_can_store_and_read_jobs_from_kvs(self): self.job_ctxt._log_level = 'debug' self.job_ctxt.params['debug'] = self.job_ctxt.log_level try: self.job_ctxt.to_kvs() job_from_kvs = JobContext.from_kvs(self.job_ctxt.job_id) self.assertEqual(self.job_ctxt.params, job_from_kvs.params) finally: helpers.cleanup_loggers()
def setUp(self): # we init the logs before each test because nosetest redefines # sys.stdout and removes all the handlers from the rootLogger # reset logging config (otherwise will ignore logfile flag) cleanup_loggers() flags.FLAGS.debug = 'warn' flags.FLAGS.logfile = LOG_FILE_PATH logs.init_logs(log_type='console', level='warn') java.init_logs(log_type='console', level='warn')
def tearDown(self): # reset Log4j config jvm = java.jvm() jvm.JClass("org.apache.log4j.BasicConfigurator").resetConfiguration() jvm.JClass("org.apache.log4j.BasicConfigurator").configure() # reset logging config cleanup_loggers() # restore process name multiprocessing.current_process().name = self.process_name
def test_can_store_and_read_jobs_from_kvs(self): flags_debug_default = flags.FLAGS.debug flags.FLAGS.debug = "debug" try: self.job = helpers.job_from_file(os.path.join(helpers.DATA_DIR, CONFIG_FILE)) job_from_kvs = CalculationProxy.from_kvs(self.job.job_id) self.assertEqual(flags.FLAGS.debug, job_from_kvs.params.pop("debug")) self.assertEqual(self.job, job_from_kvs) finally: helpers.cleanup_loggers() # Restore the default global FLAGS.debug level # so we don't break stuff. flags.FLAGS.debug = flags_debug_default
def setUp(self): # save and override process name self.process_name = multiprocessing.current_process().name multiprocessing.current_process().name = '->UnitTestProcess<-' # reset Log4j config jvm = java.jvm() jvm.JClass("org.apache.log4j.BasicConfigurator").resetConfiguration() # reset logging config cleanup_loggers() # setup AMQP logging logs.init_logs(log_type='amqp', level='debug') java.init_logs(log_type='amqp', level='debug') job.setup_job_logging('123')
def tearDown(self): # Stop all the started patches for patcher in self.patchers: patcher.stop() cleanup_loggers()
def tearDown(self): cleanup_loggers()
def setUp(self): cleanup_loggers()
def tearDown(self): # reset logging config cleanup_loggers()
def test_can_store_and_read_jobs_from_kvs(self): self.job = helpers.job_from_file( os.path.join(helpers.DATA_DIR, CONFIG_FILE)) self.generated_files.append(self.job.super_config_path) self.assertEqual(self.job, Job.from_kvs(self.job.job_id)) helpers.cleanup_loggers()