Best Python code snippet using autotest_python
base_job_unittest.py
Source: base_job_unittest.py
...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):...
context.py
Source: context.py
...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:...
Check out the latest blogs from LambdaTest on this topic:
Before we discuss Scala testing, let us understand the fundamentals of Scala and how this programming language is a preferred choice for your development requirements.The popularity and usage of Scala are rapidly rising, evident by the ever-increasing open positions for Scala developers.
So, now that the first installment of this two fold article has been published (hence you might have an idea of what Agile Testing is not in my opinion), I’ve started feeling the pressure to explain what Agile Testing actually means to me.
Did you know that according to Statista, the number of smartphone users will reach 18.22 billion by 2025? Let’s face it, digital transformation is skyrocketing and will continue to do so. This swamps the mobile app development market with various options and gives rise to the need for the best mobile app testing tools
As a developer, checking the cross browser compatibility of your CSS properties is of utmost importance when building your website. I have often found myself excited to use a CSS feature only to discover that it’s still not supported on all browsers. Even if it is supported, the feature might be experimental and not work consistently across all browsers. Ask any front-end developer about using a CSS feature whose support is still in the experimental phase in most prominent web browsers. ????
The count of mobile users is on a steep rise. According to the research, by 2025, it is expected to reach 7.49 billion users worldwide. 70% of all US digital media time comes from mobile apps, and to your surprise, the average smartphone owner uses ten apps per day and 30 apps each month.
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!