How to use test_job_abort method in autotest

Best Python code snippet using autotest_python Github


Full Screen

1import logging2from datetime import datetime3import time4import Cobalt.accounting as accounting5from Cobalt.Components.cqm import Job6from StringIO import StringIO7def dt_strptime (date_string, format):8 return datetime(*(time.strptime(date_string, format)[0:6]))9class FakeDatetime (datetime):10 11 @classmethod12 def now (cls):13 return cls(2000, 1, 1)14class TestAccounting (object):15 16 def setup (self):17 #logging.basicConfig()18 = StringIO()19 #self.handler = logging.StreamHandler( #accounting.logger.addHandler(self.handler)21 #accounting.logger.setLevel(logging.INFO)22 accounting.datetime = FakeDatetime23 24 def teardown (self):25 #accounting.logger.removeHandler(self.handler)26 #accounting.logger.setLevel(logging.NOTSET)27 accounting.datetime = datetime28 29 def test_log (self):30 log_entry = accounting.entry("A", 123,31 {'val1':1, 'val2':"foo", 'val3':"bar baz"})32 assert log_entry == \33 "01/01/2000 00:00:00;A;123;val1=1 val2=foo val3=\"bar baz\"", \34 log_entry35 36 def test_job_abort (self):37 job = Job({'jobid':123})38 log_entry = accounting.abort(job.jobid)39 assert log_entry == \40 "01/01/2000 00:00:00;A;123;", log_entry41 42 def test_job_checkpoint (self):43 job = Job({'jobid':123})44 log_entry = accounting.checkpoint(job.jobid)45 assert log_entry == \46 "01/01/2000 00:00:00;C;123;", log_entry47 48 def test_job_delete (self):49 job = Job({'jobid':123})50 log_entry = accounting.delete(job.jobid, "")51 assert log_entry == \52 "01/01/2000 00:00:00;D;123;", log_entry53 54 def test_job_end (self):55 job = Job({'jobid':123})56 #group and session are unknown57 log_entry = accounting.end(job.jobid, job.user,58 "unknown", job.jobname, job.queue,59 job.outputdir, job.command, job.args, job.mode,60 0.1, 0.2, 0.3, -1.0, None,61 {'ncpus':job.procs, 'nodect':job.nodes,62 'walltime':str(job.walltime * 60)},63 "unknown", -2.0, 255,64 {'location':"ANL",65 'nodect':job.nodes,66 'walltime':"0.0"})67 68 #accounting.end(job.jobid, job.user,,69 #, job.queue, job.cwd, job.cmd, job.args, job.mode70 # job.)71 assert log_entry == \...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:


You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run autotest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?