How to use push_execution_context method in autotest

Best Python code snippet using autotest_python

base_job_unittest.py

Source:base_job_unittest.py Github

copy

Full Screen

...159 self.assertRaises(IndexError, self.job.pop_execution_context)160 def test_push_changes_to_subdir(self):161 sub1 = os.path.join(self.resultdir, 'sub1')162 os.mkdir(sub1)163 self.job.push_execution_context('sub1')164 self.assertEqual(self.job.resultdir, sub1)165 def test_push_creates_subdir(self):166 sub2 = os.path.join(self.resultdir, 'sub2')167 self.job.push_execution_context('sub2')168 self.assertEqual(self.job.resultdir, sub2)169 self.assert_(os.path.exists(sub2))170 def test_push_handles_absolute_paths(self):171 otherresults = tempfile.mkdtemp(suffix='unittest')172 try:173 self.job.push_execution_context(otherresults)174 self.assertEqual(self.job.resultdir, otherresults)175 finally:176 shutil.rmtree(otherresults, ignore_errors=True)177 def test_pop_restores_context(self):178 sub3 = os.path.join(self.resultdir, 'sub3')179 self.job.push_execution_context('sub3')180 self.assertEqual(self.job.resultdir, sub3)181 self.job.pop_execution_context()182 self.assertEqual(self.job.resultdir, self.resultdir)183 def test_push_and_pop_are_fifo(self):184 sub4 = os.path.join(self.resultdir, 'sub4')185 subsub = os.path.join(sub4, 'subsub')186 self.job.push_execution_context('sub4')187 self.assertEqual(self.job.resultdir, sub4)188 self.job.push_execution_context('subsub')189 self.assertEqual(self.job.resultdir, subsub)190 self.job.pop_execution_context()191 self.assertEqual(self.job.resultdir, sub4)192 self.job.pop_execution_context()193 self.assertEqual(self.job.resultdir, self.resultdir)194class test_job_directory(unittest.TestCase):195 def setUp(self):196 self.testdir = tempfile.mkdtemp(suffix='unittest')197 self.original_wd = os.getcwd()198 os.chdir(self.testdir)199 def tearDown(self):200 os.chdir(self.original_wd)201 shutil.rmtree(self.testdir, ignore_errors=True)202 def test_passes_if_dir_exists(self):...

Full Screen

Full Screen

context.py

Source:context.py Github

copy

Full Screen

...10 return inner11class AioExecutionContext(_aio_callable_context_manager, ExecutionContext):12 async def __aenter__(self):13 async with self.database._conn_lock:14 self.database.push_execution_context(self)15 self.connection = await self.database._connect(16 self.database.database,17 **self.database.connect_kwargs)18 if self.with_transaction:19 self.txn = self.database.transaction()20 await self.txn.__aenter__()21 return self22 async def __aexit__(self, exc_type, exc_val, exc_tb):23 async with self.database._conn_lock:24 if self.connection is None:25 self.database.pop_execution_context()26 else:27 try:28 if self.with_transaction:...

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

Helpful

NotHelpful