Пример #1
0
def testMigrateTimesOut(monkeypatch):
    monkeypatch.setattr(migration_tool, '_call_migration_script',
                        lambda *x: exec('raise(TimeoutError())'))
    monkeypatch.setattr(migration_tool, '_get_migration_scripts',
                        lambda *x: TEST_MIGRATION_SCRIPTS)

    with pytest.raises(TimeoutError):
        migration_tool.migrate(TEST_VERSION, TEST_NEW_VERSION, TEST_TIMEOUT)
Пример #2
0
def testMigrate(monkeypatch):
    testList = []

    monkeypatch.setattr(importlib, 'import_module', testList.append)
    monkeypatch.setattr(migration_tool, '_get_migration_scripts', lambda *x: TEST_MIGRATION_SCRIPTS)

    assert migration_tool.migrate(TEST_VERSION, TEST_NEW_VERSION, TEST_TIMEOUT) == 3
    assert len(testList) == 3
Пример #3
0
def testMigrate(monkeypatch):
    testList = []

    monkeypatch.setattr(migration_tool, '_call_migration_script',
                        lambda *x: testList.append(x[0]))
    monkeypatch.setattr(migration_tool, '_get_migration_scripts',
                        lambda *x: TEST_MIGRATION_SCRIPTS)

    assert migration_tool.migrate(TEST_VERSION, TEST_NEW_VERSION,
                                  TEST_TIMEOUT) == 3
    assert len(testList) == 3
Пример #4
0
 def _migrate(self, current_version, new_version):
     migrate(current_version, new_version, self.timeout)
Пример #5
0
 def _migrate(self, current_version, new_version):
     migrate(current_version, new_version, self.timeout)
Пример #6
0
def testMigrateTimesOut(monkeypatch):
    monkeypatch.setattr(importlib, 'import_module', lambda *x: time.sleep(TEST_TIMEOUT * 2))
    monkeypatch.setattr(migration_tool, '_get_migration_scripts', lambda *x: TEST_MIGRATION_SCRIPTS)

    with pytest.raises(TimeoutError):
        migration_tool.migrate(TEST_VERSION, TEST_NEW_VERSION, TEST_TIMEOUT)