def test_levels(self): jc = JobConfig() self.assertIs(None, jc.tracing) for tl in {'error', 'warn', 'info', 'debug', 'trace'}: jc.tracing = tl self.assertEqual(tl, jc.tracing) jc.tracing = None self.assertIs(None, jc.tracing) jc.tracing = logging.CRITICAL self.assertEqual('error', jc.tracing) jc.tracing = logging.ERROR self.assertEqual('error', jc.tracing) jc.tracing = logging.WARNING self.assertEqual('warn', jc.tracing) jc.tracing = logging.INFO self.assertEqual('info', jc.tracing) jc.tracing = logging.DEBUG self.assertEqual('debug', jc.tracing) jc.tracing = logging.NOTSET self.assertIs(None, jc.tracing) self.assertRaises(ValueError, set_trace, jc, 'WARN') jc2 = JobConfig(tracing='info') self.assertEqual('info', jc2.tracing)
def test_levels(self): jc = JobConfig() self.assertIs(None, jc.tracing) for tl in {'error', 'warn', 'info', 'debug', 'trace'}: jc.tracing = tl self.assertEqual(tl, jc.tracing) jc.tracing = None self.assertIs(None, jc.tracing) jc.tracing = logging.CRITICAL self.assertEqual('error', jc.tracing) jc.tracing = logging.ERROR self.assertEqual('error', jc.tracing) jc.tracing = logging.WARNING self.assertEqual('warn', jc.tracing) jc.tracing = logging.INFO self.assertEqual('info', jc.tracing) jc.tracing = logging.DEBUG self.assertEqual('debug', jc.tracing) jc.tracing = logging.NOTSET self.assertIs(None, jc.tracing) self.assertRaises(ValueError, set_trace, jc, 'WARN') jc2 = JobConfig(tracing='info') self.assertEqual('info', jc2.tracing)
def test_UnicodeJobName(self): """ Test unicode topo names """ job_name = '你好世界' topo = Topology() jc = JobConfig(job_name=job_name) # When tracing is info some extra code is invoked # to trace all Python packages. Ensure it is exercised. jc.tracing = 'info' hw = topo.source(["Hello", "Tester"]) tester = Tester(topo) tester.contents(hw, ["Hello", "Tester"]) jc.add(self.test_config) self.assertIs(jc, self.test_config[ConfigParams.JOB_CONFIG]) sr = tester.test(self.test_ctxtype, self.test_config) self.assertEqual(job_name, tester.result['submission_result']['name'])
def test_UnicodeJobName(self): """ Test unicode topo names """ job_name = '你好世界' topo = Topology() jc = JobConfig(job_name=job_name) # When tracing is info some extra code is invoked # to trace all Python packages. Ensure it is exercised. jc.tracing = 'info' hw = topo.source(["Hello", "Tester"]) tester = Tester(topo) tester.contents(hw, ["Hello", "Tester"]) jc.add(self.test_config) self.assertIs(jc, self.test_config[ConfigParams.JOB_CONFIG]) sr = tester.test(self.test_ctxtype, self.test_config) self.assertEqual(job_name, tester.result['submission_result']['name'])