sqlalchemy-migrate/migrate/tests/fixture/shell.py
Thomas Goirand b58b4a353c fix scripttest compat
There's no script_path param in the current version of
scripttest. This patch fixes that by removing the param,
which by the way isn't useful.

Change-Id: Ic78cea25bb472702473e98b48a8ff74c01545aa3
2014-03-05 08:20:54 -05:00

34 lines
926 B
Python

#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import logging
from scripttest import TestFileEnvironment
from migrate.tests.fixture.pathed import *
log = logging.getLogger(__name__)
class Shell(Pathed):
"""Base class for command line tests"""
def setUp(self):
super(Shell, self).setUp()
migrate_path = os.path.dirname(sys.executable)
# PATH to migrate development script folder
log.debug('PATH for ScriptTest: %s', migrate_path)
self.env = TestFileEnvironment(
base_path=os.path.join(self.temp_usable_dir, 'env'),
)
def run_version(self, repos_path):
result = self.env.run('migrate version %s' % repos_path)
return int(result.stdout.strip())
def run_db_version(self, url, repos_path):
result = self.env.run('migrate db_version %s %s' % (url, repos_path))
return int(result.stdout.strip())