How to use mark_started method in Slash

Best Python code snippet using slash

jobs_test.py

Source:jobs_test.py Github

copy

Full Screen

...41 self.assertIsNone(new_job.output)42 def test_job_completion(self):43 new_job = self.DummyJob()44 new_job.mark_queued()45 new_job.mark_started()46 self.assertEqual(new_job.status_code, jobs.STATUS_CODE_STARTED)47 new_job.mark_completed(20, 'output')48 self.assertEqual(new_job.execution_time_sec, 20)49 self.assertEqual(new_job.status_code, jobs.STATUS_CODE_COMPLETED)50 self.assertEqual(new_job.output, 'output')51 def test_job_failure(self):52 new_job = self.DummyJob()53 new_job.mark_queued()54 new_job.mark_started()55 self.assertEqual(new_job.status_code, jobs.STATUS_CODE_STARTED)56 self.assertTrue(new_job.is_active)57 new_job.mark_failed(20, 'output')58 self.assertEqual(new_job.execution_time_sec, 20)59 self.assertEqual(new_job.status_code, jobs.STATUS_CODE_FAILED)60 self.assertEqual(new_job.output, 'output')61 self.assertFalse(new_job.is_active)62 def test_job_restart(self):63 new_job = self.DummyJob()64 new_job.mark_queued()65 new_job.mark_started()66 new_job.mark_queued()67 self.assertEqual(new_job.execution_time_sec, 0)68 self.assertEqual(new_job.status_code, jobs.STATUS_CODE_QUEUED)69 self.assertIsNone(new_job.output)70 new_job.mark_started()71 new_job.mark_failed(20, 'output')72 self.assertEqual(new_job.status_code, jobs.STATUS_CODE_FAILED)73 new_job.mark_queued()74 self.assertEqual(new_job.execution_time_sec, 0)75 self.assertEqual(new_job.status_code, jobs.STATUS_CODE_QUEUED)76 self.assertIsNone(new_job.output)77 def test_status_code_transitions(self):78 """Test that invalid status code transitions are caught."""79 new_job = self.DummyJob()80 with self.assertRaisesRegexp(Exception, 'Job was not created'):81 new_job.mark_started()82 with self.assertRaisesRegexp(Exception, 'Job was not created'):83 new_job.mark_completed(20, 'output')84 with self.assertRaisesRegexp(Exception, 'Job was not created'):85 new_job.mark_failed(20, 'output')86 new_job.mark_queued()87 with self.assertRaisesRegexp(Exception, 'Invalid status code change'):88 new_job.mark_completed(20, 'output')89 with self.assertRaisesRegexp(Exception, 'Invalid status code change'):90 new_job.mark_failed(20, 'output')91 new_job.mark_started()92 new_job.mark_completed(20, 'output')93 new_job.mark_queued()94 def test_different_jobs_are_independent(self):95 new_job = self.DummyJob()96 another_job = self.AnotherDummyJob()97 new_job.mark_queued()98 new_job.mark_started()99 another_job.mark_queued()100 new_job.mark_failed(20, 'output')101 self.assertEqual(new_job.status_code, jobs.STATUS_CODE_FAILED)102 self.assertEqual(another_job.status_code, jobs.STATUS_CODE_QUEUED)103 def test_one_job_runs_per_class(self):104 # This tests that different instances of a job class refer to the same105 # backend job.106 new_job = self.DummyJob()107 new_job.mark_queued()108 new_job.mark_started()109 same_job = self.DummyJob()110 self.assertEqual(same_job.status_code, jobs.STATUS_CODE_STARTED)111 def test_can_only_instantiate_valid_jobs(self):112 new_job = self.DummyJob()113 new_job.mark_queued()114 new_job.mark_started()115 with self.assertRaisesRegexp(116 Exception, 'Tried to directly initialize'):...

Full Screen

Full Screen

test_concurrent_datasets.py

Source:test_concurrent_datasets.py Github

copy

Full Screen

...6from qcodes.dataset.data_set import DataSet7def test_foreground_after_background_raises(empty_temp_db_connection):8 new_experiment("test", "test1", conn=empty_temp_db_connection)9 ds1 = DataSet(conn=empty_temp_db_connection)10 ds1.mark_started(start_bg_writer=True)11 ds2 = DataSet(conn=empty_temp_db_connection)12 with pytest.raises(RuntimeError, match="All datasets written"):13 ds2.mark_started(start_bg_writer=False)14def test_background_after_foreground_raises(empty_temp_db_connection):15 new_experiment("test", "test1", conn=empty_temp_db_connection)16 ds1 = DataSet(conn=empty_temp_db_connection)17 ds1.mark_started(start_bg_writer=False)18 ds2 = DataSet(conn=empty_temp_db_connection)19 with pytest.raises(RuntimeError, match="All datasets written"):20 ds2.mark_started(start_bg_writer=True)21def test_background_twice(empty_temp_db_connection):22 new_experiment("test", "test1", conn=empty_temp_db_connection)23 ds1 = DataSet(conn=empty_temp_db_connection)24 ds1.mark_started(start_bg_writer=True)25 ds2 = DataSet(conn=empty_temp_db_connection)26 ds2.mark_started(start_bg_writer=True)27def test_foreground_twice(empty_temp_db_connection):28 new_experiment("test", "test1", conn=empty_temp_db_connection)29 ds1 = DataSet(conn=empty_temp_db_connection)30 ds1.mark_started(start_bg_writer=False)31 ds2 = DataSet(conn=empty_temp_db_connection)32 ds2.mark_started(start_bg_writer=False)33def test_foreground_after_background_non_concurrent(empty_temp_db_connection):34 new_experiment("test", "test1", conn=empty_temp_db_connection)35 ds1 = DataSet(conn=empty_temp_db_connection)36 ds1.mark_started(start_bg_writer=True)37 ds1.mark_completed()38 ds2 = DataSet(conn=empty_temp_db_connection)39 ds2.mark_started(start_bg_writer=False)40 ds2.mark_completed()41 ds3 = DataSet(conn=empty_temp_db_connection)42 ds3.mark_started(start_bg_writer=True)...

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:

YouTube

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

Run Slash 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?

Helpful

NotHelpful