How to use fix_iteration_tables method in autotest

Best Python code snippet using autotest_python Github


Full Screen

...68 """69 cursor = connection.cursor()70 cursor.execute('DROP TABLE tko_test_view_2')71 cursor.execute(_CREATE_TEST_VIEW)72def fix_iteration_tables():73 """74 Since iteration tables don't have any real primary key, we "fake" one in the75 Django models. So fix up the generated schema to match the real schema.76 """77 cursor = connection.cursor()78 cursor.execute('DROP TABLE tko_iteration_attributes')79 cursor.execute(_CREATE_ITERATION_ATTRIBUTES)80 cursor.execute('DROP TABLE tko_iteration_result')81 cursor.execute(_CREATE_ITERATION_RESULTS)82class TkoTestMixin(object):83 def _patch_sqlite_stuff(self):84 self.god.stub_with(models.TempManager, '_get_column_names',85 self._get_column_names_for_sqlite3)86 self.god.stub_with(models.TempManager, '_cursor_rowcount',87 self._cursor_rowcount_for_sqlite3)88 # add some functions to SQLite for MySQL compatibility89 connection.cursor() # ensure connection is alive90 connection.connection.create_function('if', 3, self._sqlite_if)91 connection.connection.create_function('find_in_set', 2,92 self._sqlite_find_in_set)93 fix_iteration_tables()94 def _cursor_rowcount_for_sqlite3(self, cursor):95 return len(cursor.fetchall())96 def _sqlite_find_in_set(self, needle, haystack):97 return needle in haystack.split(',')98 def _sqlite_if(self, condition, true_result, false_result):99 if condition:100 return true_result101 return false_result102 # sqlite takes any columns that don't have aliases and names them103 # "table_name"."column_name". we map these to just column_name.104 _SQLITE_AUTO_COLUMN_ALIAS_RE = re.compile(r'".+"\."(.+)"')105 def _get_column_names_for_sqlite3(self, cursor):106 names = [column_info[0] for column_info in cursor.description]107 # replace all "table_name"."column_name" constructs with just...

Full Screen

Full Screen Github


Full Screen

...65 """66 cursor = connection.cursor()67 cursor.execute('DROP TABLE test_view_2')68 cursor.execute(_CREATE_TEST_VIEW)69def fix_iteration_tables():70 """71 Since iteration tables don't have any real primary key, we "fake" one in the72 Django models. So fix up the generated schema to match the real schema.73 """74 cursor = connection.cursor()75 cursor.execute('DROP TABLE iteration_attributes')76 cursor.execute(_CREATE_ITERATION_ATTRIBUTES)77 cursor.execute('DROP TABLE iteration_result')78 cursor.execute(_CREATE_ITERATION_RESULTS)79class RpcInterfaceTest(unittest.TestCase):80 def setUp(self):81 self._god = mock.mock_god()82 setup_test_environment.set_up()83 fix_iteration_tables()84 setup_test_view()85 self._create_initial_data()86 def tearDown(self):87 setup_test_environment.tear_down()88 self._god.unstub_all()89 def _create_initial_data(self):90 machine = models.Machine.objects.create(hostname='myhost')91 kernel_name = 'mykernel1'92 kernel1 = models.Kernel.objects.create(kernel_hash=kernel_name,93 base=kernel_name,94 printable=kernel_name)95 kernel_name = 'mykernel2'96 kernel2 = models.Kernel.objects.create(kernel_hash=kernel_name,97 base=kernel_name,...

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?