Best Python code snippet using autotest_python
settings_unittest.py
Source:settings_unittest.py
...42 conf = settings.settings43 def setUp(self):44 # set the config files to our test files45 (self.global_temp, self.shadow_temp) = create_config_files()46 self.conf.set_config_files(self.global_temp.name, self.shadow_temp.name)47 def tearDown(self):48 self.shadow_temp.clean()49 self.global_temp.clean()50 self.conf.set_config_files(settings.DEFAULT_CONFIG_FILE,51 settings.DEFAULT_SHADOW_FILE)52 def test_float(self):53 val = self.conf.get_value("SECTION_A", "value_1", float)54 self.assertEquals(type(val), types.FloatType)55 self.assertEquals(val, 6.0)56 def test_int(self):57 val = self.conf.get_value("SECTION_B", "value_1", int)58 self.assertEquals(type(val), types.IntType)59 self.assertTrue(val < 0)60 val = self.conf.get_value("SECTION_B", "value_3", int)61 self.assertEquals(val, 0)62 val = self.conf.get_value("SECTION_B", "value_4", int)63 self.assertTrue(val > 0)64 def test_string(self):...
test_config.py
Source:test_config.py
...47 with tempfile.NamedTemporaryFile(mode='w', delete=True) as tmp:48 tmp.write("[haproxy_amphora]\n"49 "active_connection_retry_interval=4\n")50 tmp.flush()51 conf.set_config_files([tmp.name])52 self.assertEqual(53 4,54 conf.conf.haproxy_amphora.active_connection_retry_interval)55 # Test deprecated name56 with tempfile.NamedTemporaryFile(mode='w', delete=True) as tmp:57 tmp.write("[haproxy_amphora]\n"58 "active_connection_rety_interval=3\n")59 tmp.flush()60 conf.set_config_files([tmp.name])61 self.assertEqual(62 3,...
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!!