How to use _set_migrations_dir method in autotest

Best Python code snippet using autotest_python

migrate.py

Source:migrate.py Github

copy

Full Screen

...51 migrations_dir = None52 def __init__(self, database_connection, migrations_dir=None, force=False):53 self._database = database_connection54 self.force = force55 self._set_migrations_dir(migrations_dir)56 def _set_migrations_dir(self, migrations_dir=None):57 config_section = self._database.global_config_section58 if migrations_dir is None:59 migrations_dir = os.path.abspath(60 _MIGRATIONS_DIRS.get(config_section, _DEFAULT_MIGRATIONS_DIR))61 self.migrations_dir = migrations_dir62 sys.path.append(migrations_dir)63 assert os.path.exists(migrations_dir), migrations_dir + " doesn't exist"64 def _get_db_name(self):65 return self._database.get_database_info()['db_name']66 def execute(self, query, *parameters):67 return self._database.execute(query, parameters)68 def execute_script(self, script):69 sql_statements = [statement.strip()70 for statement in script.split(';')...

Full Screen

Full Screen

migrate_unittest.py

Source:migrate_unittest.py Github

copy

Full Screen

...33 def migrate_down(self, manager):34 self.do_migration(self.version, 'down')35MIGRATIONS = [DummyMigration(n) for n in xrange(1, NUM_MIGRATIONS + 1)]36class TestableMigrationManager(migrate.MigrationManager):37 def _set_migrations_dir(self, migrations_dir=None):38 pass39 def get_migrations(self, minimum_version=None, maximum_version=None):40 minimum_version = minimum_version or 141 maximum_version = maximum_version or len(MIGRATIONS)42 return MIGRATIONS[minimum_version-1:maximum_version]43class MigrateManagerTest(unittest.TestCase):44 def setUp(self):45 self._database = (46 database_connection.DatabaseConnection.get_test_database())47 self._database.connect()48 self.manager = TestableMigrationManager(self._database)49 DummyMigration.clear_migrations_done()50 def tearDown(self):51 self._database.disconnect()...

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