summaryrefslogtreecommitdiff
path: root/migrate/tests
diff options
context:
space:
mode:
authorDavid Ripton <dripton@redhat.com>2014-02-26 15:04:54 -0500
committerDavid Ripton <dripton@redhat.com>2014-02-26 15:04:54 -0500
commitd6fbf12989e85b8cdbd0202653ef6a2709c16bf5 (patch)
tree4b48c826064052840e18ac1ee1d7a6e59016f543 /migrate/tests
parent21fcdad0f485437d010e5743626c63ab3acdaec5 (diff)
downloadsqalchemy-migrate-d6fbf12989e85b8cdbd0202653ef6a2709c16bf5.tar.gz
Eradicate trailing whitespace
Remove all trailing spaces and tabs in every file in the project. People have editors configured to do this, which causes them to accidentally make little whitespace changes in unrelated commits, which makes those commits harder to review. Better to fix them all at once. Change-Id: I17d89f55f41d8599e0ab1a31f646cd161289703e
Diffstat (limited to 'migrate/tests')
-rw-r--r--migrate/tests/changeset/test_changeset.py48
-rw-r--r--migrate/tests/changeset/test_constraint.py6
-rw-r--r--migrate/tests/fixture/database.py6
-rw-r--r--migrate/tests/fixture/pathed.py12
-rw-r--r--migrate/tests/versioning/test_cfgparse.py2
-rw-r--r--migrate/tests/versioning/test_keyedinstance.py2
-rw-r--r--migrate/tests/versioning/test_pathed.py4
-rw-r--r--migrate/tests/versioning/test_repository.py14
-rw-r--r--migrate/tests/versioning/test_schema.py12
-rw-r--r--migrate/tests/versioning/test_schemadiff.py12
-rw-r--r--migrate/tests/versioning/test_script.py2
-rw-r--r--migrate/tests/versioning/test_shell.py30
-rw-r--r--migrate/tests/versioning/test_util.py8
-rw-r--r--migrate/tests/versioning/test_version.py12
14 files changed, 85 insertions, 85 deletions
diff --git a/migrate/tests/changeset/test_changeset.py b/migrate/tests/changeset/test_changeset.py
index 8b4a6be..1ea7219 100644
--- a/migrate/tests/changeset/test_changeset.py
+++ b/migrate/tests/changeset/test_changeset.py
@@ -65,7 +65,7 @@ class TestAddDropColumn(fixture.DB):
result = len(self.table.primary_key)
self.assertEqual(result, num_of_expected_cols)
- # we have 1 columns and there is no data column
+ # we have 1 columns and there is no data column
assert_numcols(1)
self.assertTrue(getattr(self.table.c, 'data', None) is None)
if len(col_p) == 0:
@@ -147,7 +147,7 @@ class TestAddDropColumn(fixture.DB):
# Not necessarily bound to table
return self.table.drop_column(col.name)
return self.run_(add_func, drop_func)
-
+
@fixture.usedb()
def test_byname(self):
"""Add/drop columns via functions; by table object and column name"""
@@ -302,7 +302,7 @@ class TestAddDropColumn(fixture.DB):
if index.name=='ix_data':
break
self.assertEqual(expected,index.unique)
-
+
@fixture.usedb()
def test_index(self):
col = Column('data', Integer)
@@ -311,7 +311,7 @@ class TestAddDropColumn(fixture.DB):
self._check_index(False)
col.drop()
-
+
@fixture.usedb()
def test_index_unique(self):
# shows how to create a unique index
@@ -332,7 +332,7 @@ class TestAddDropColumn(fixture.DB):
self._check_index(True)
col.drop()
-
+
@fixture.usedb()
def test_server_defaults(self):
"""Can create columns with server_default values"""
@@ -382,7 +382,7 @@ class TestAddDropColumn(fixture.DB):
sorted([i.name for i in self.table.indexes]),
[u'ix_tmp_adddropcol_d1', u'ix_tmp_adddropcol_d2']
)
-
+
# delete one
self.table.c.d2.drop()
@@ -392,7 +392,7 @@ class TestAddDropColumn(fixture.DB):
sorted([i.name for i in self.table.indexes]),
[u'ix_tmp_adddropcol_d1']
)
-
+
def _actual_foreign_keys(self):
from sqlalchemy.schema import ForeignKeyConstraint
result = []
@@ -406,12 +406,12 @@ class TestAddDropColumn(fixture.DB):
result.append(col_names)
result.sort()
return result
-
+
@fixture.usedb()
def test_drop_with_foreign_keys(self):
self.table.drop()
self.meta.clear()
-
+
# create FK's target
reftable = Table('tmp_ref', self.meta,
Column('id', Integer, primary_key=True),
@@ -419,7 +419,7 @@ class TestAddDropColumn(fixture.DB):
if self.engine.has_table(reftable.name):
reftable.drop()
reftable.create()
-
+
# add a table with two foreign key columns
self.table = Table(
self.table_name, self.meta,
@@ -432,13 +432,13 @@ class TestAddDropColumn(fixture.DB):
# paranoid check
self.assertEqual([['r1'],['r2']],
self._actual_foreign_keys())
-
+
# delete one
if self.engine.name == 'mysql':
constraint.ForeignKeyConstraint([self.table.c.r2], [reftable.c.id],
name='test_fk2').drop()
self.table.c.r2.drop()
-
+
# check remaining foreign key is there
self.assertEqual([['r1']],
self._actual_foreign_keys())
@@ -447,7 +447,7 @@ class TestAddDropColumn(fixture.DB):
def test_drop_with_complex_foreign_keys(self):
from sqlalchemy.schema import ForeignKeyConstraint
from sqlalchemy.schema import UniqueConstraint
-
+
self.table.drop()
self.meta.clear()
@@ -465,7 +465,7 @@ class TestAddDropColumn(fixture.DB):
if self.engine.has_table(reftable.name):
reftable.drop()
reftable.create()
-
+
# add a table with a complex foreign key constraint
self.table = Table(
self.table_name, self.meta,
@@ -481,21 +481,21 @@ class TestAddDropColumn(fixture.DB):
# paranoid check
self.assertEqual([['r1','r2']],
self._actual_foreign_keys())
-
+
# delete one
if self.engine.name == 'mysql':
constraint.ForeignKeyConstraint([self.table.c.r1, self.table.c.r2],
[reftable.c.id, reftable.c.jd],
name='test_fk').drop()
self.table.c.r2.drop()
-
+
# check the constraint is gone, since part of it
# is no longer there - if people hit this,
# they may be confused, maybe we should raise an error
# and insist that the constraint is deleted first, separately?
self.assertEqual([],
self._actual_foreign_keys())
-
+
class TestRename(fixture.DB):
"""Tests for table and index rename methods"""
level = fixture.DB.CONNECT
@@ -575,7 +575,7 @@ class TestRename(fixture.DB):
# test by just the string
rename_table(table_name1, table_name2, engine=self.engine)
assert_table_name(table_name2, True) # object not updated
-
+
# Index renames
if self.url.startswith('sqlite') or self.url.startswith('mysql'):
self.assertRaises(exceptions.NotSupportedError,
@@ -671,7 +671,7 @@ class TestColumnChange(fixture.DB):
self.assert_('atad' not in self.table.c.keys())
self.table.c.data # Should not raise exception
self.assertEqual(num_rows(self.table.c.data,content), 1)
-
+
@fixture.usedb()
def test_type(self):
# Test we can change a column's type
@@ -695,12 +695,12 @@ class TestColumnChange(fixture.DB):
@fixture.usedb()
def test_default(self):
"""Can change a column's server_default value (DefaultClauses only)
- Only DefaultClauses are changed here: others are managed by the
+ Only DefaultClauses are changed here: others are managed by the
application / by SA
"""
self.assertEqual(self.table.c.data.server_default.arg, 'tluafed')
- # Just the new default
+ # Just the new default
default = 'my_default'
self.table.c.data.alter(server_default=DefaultClause(default))
self.refresh_table(self.table.name)
@@ -750,7 +750,7 @@ class TestColumnChange(fixture.DB):
# py 2.4 compatability :-/
cw = catch_warnings(record=True)
w = cw.__enter__()
-
+
warnings.simplefilter("always")
self.table.c.data.alter(Column('data', String(100)))
@@ -763,7 +763,7 @@ class TestColumnChange(fixture.DB):
str(w[-1].message))
finally:
cw.__exit__()
-
+
@fixture.usedb()
def test_alter_returns_delta(self):
"""Test if alter constructs return delta"""
@@ -791,7 +791,7 @@ class TestColumnChange(fixture.DB):
if self.engine.name == 'firebird':
del kw['nullable']
self.table.c.data.alter(**kw)
-
+
# test altered objects
self.assertEqual(self.table.c.data.server_default.arg, 'foobar')
if not self.engine.name == 'firebird':
diff --git a/migrate/tests/changeset/test_constraint.py b/migrate/tests/changeset/test_constraint.py
index 5527559..941030a 100644
--- a/migrate/tests/changeset/test_constraint.py
+++ b/migrate/tests/changeset/test_constraint.py
@@ -13,7 +13,7 @@ from migrate.tests import fixture
class CommonTestConstraint(fixture.DB):
"""helper functions to test constraints.
-
+
we just create a fresh new table and make sure everything is
as required.
"""
@@ -257,7 +257,7 @@ class TestAutoname(CommonTestConstraint):
cons = CheckConstraint('id > 3', columns=[self.table.c.id])
cons.create()
self.refresh_table()
-
+
if not self.engine.name == 'mysql':
self.table.insert(values={'id': 4, 'fkey': 1}).execute()
try:
@@ -280,7 +280,7 @@ class TestAutoname(CommonTestConstraint):
cons = UniqueConstraint(self.table.c.fkey)
cons.create()
self.refresh_table()
-
+
self.table.insert(values={'fkey': 4, 'id': 1}).execute()
try:
self.table.insert(values={'fkey': 4, 'id': 2}).execute()
diff --git a/migrate/tests/fixture/database.py b/migrate/tests/fixture/database.py
index e000d60..90b25d5 100644
--- a/migrate/tests/fixture/database.py
+++ b/migrate/tests/fixture/database.py
@@ -65,7 +65,7 @@ def usedb(supported=None, not_supported=None):
@param supported: run tests for ONLY these databases
@param not_supported: run tests for all databases EXCEPT these
- If both supported and not_supported are empty, all dbs are assumed
+ If both supported and not_supported are empty, all dbs are assumed
to be supported
"""
if supported is not None and not_supported is not None:
@@ -126,7 +126,7 @@ class DB(Base):
level = TXN
def _engineInfo(self, url=None):
- if url is None:
+ if url is None:
url = self.url
return url
@@ -151,7 +151,7 @@ class DB(Base):
if self.level < self.CONNECT:
return
#self.session = create_session(bind=self.engine)
- if self.level < self.TXN:
+ if self.level < self.TXN:
return
#self.txn = self.session.begin()
diff --git a/migrate/tests/fixture/pathed.py b/migrate/tests/fixture/pathed.py
index b36aa08..78cf4cd 100644
--- a/migrate/tests/fixture/pathed.py
+++ b/migrate/tests/fixture/pathed.py
@@ -30,10 +30,10 @@ class Pathed(base.Base):
@classmethod
def _tmp(cls, prefix='', suffix=''):
"""Generate a temporary file name that doesn't exist
- All filenames are generated inside a temporary directory created by
- tempfile.mkdtemp(); only the creating user has access to this directory.
- It should be secure to return a nonexistant temp filename in this
- directory, unless the user is messing with their own files.
+ All filenames are generated inside a temporary directory created by
+ tempfile.mkdtemp(); only the creating user has access to this directory.
+ It should be secure to return a nonexistant temp filename in this
+ directory, unless the user is messing with their own files.
"""
file, ret = tempfile.mkstemp(suffix,prefix,cls._tmpdir)
os.close(file)
@@ -43,7 +43,7 @@ class Pathed(base.Base):
@classmethod
def tmp(cls, *p, **k):
return cls._tmp(*p, **k)
-
+
@classmethod
def tmp_py(cls, *p, **k):
return cls._tmp(suffix='.py', *p, **k)
@@ -63,7 +63,7 @@ class Pathed(base.Base):
@classmethod
def purge(cls, path):
"""Removes this path if it exists, in preparation for tests
- Careful - all tests should take place in /tmp.
+ Careful - all tests should take place in /tmp.
We don't want to accidentally wipe stuff out...
"""
if os.path.exists(path):
diff --git a/migrate/tests/versioning/test_cfgparse.py b/migrate/tests/versioning/test_cfgparse.py
index 27f52cd..1d0d7e8 100644
--- a/migrate/tests/versioning/test_cfgparse.py
+++ b/migrate/tests/versioning/test_cfgparse.py
@@ -17,7 +17,7 @@ class TestConfigParser(fixture.Base):
parser.set('section','option','value')
self.assertEqual(parser.get('section', 'option'), 'value')
self.assertEqual(parser.to_dict()['section']['option'], 'value')
-
+
def test_table_config(self):
"""We should be able to specify the table to be used with a repository"""
default_text = Repository.prepare_config(Template().get_repository(),
diff --git a/migrate/tests/versioning/test_keyedinstance.py b/migrate/tests/versioning/test_keyedinstance.py
index 28f3b2b..d5e6ba2 100644
--- a/migrate/tests/versioning/test_keyedinstance.py
+++ b/migrate/tests/versioning/test_keyedinstance.py
@@ -19,7 +19,7 @@ class TestKeydInstance(fixture.Base):
return str(key)
def __init__(self,value):
self.value=value
-
+
a10 = Uniq1('a')
# Different key: different instance
diff --git a/migrate/tests/versioning/test_pathed.py b/migrate/tests/versioning/test_pathed.py
index 7616e9d..2798067 100644
--- a/migrate/tests/versioning/test_pathed.py
+++ b/migrate/tests/versioning/test_pathed.py
@@ -12,7 +12,7 @@ class TestPathed(fixture.Base):
self.assert_(result==Pathed._parent_path(filepath))
self.assert_(result==Pathed._parent_path(dirpath))
self.assert_(result==Pathed._parent_path(sdirpath))
-
+
def test_new(self):
"""Pathed(path) shouldn't create duplicate objects of the same path"""
path='/fgsfds'
@@ -34,7 +34,7 @@ class TestPathed(fixture.Base):
parent=None
children=0
def _init_child(self,child,path):
- """Keep a tally of children.
+ """Keep a tally of children.
(A real class might do something more interesting here)
"""
self.__class__.children+=1
diff --git a/migrate/tests/versioning/test_repository.py b/migrate/tests/versioning/test_repository.py
index 7065368..37bb5e7 100644
--- a/migrate/tests/versioning/test_repository.py
+++ b/migrate/tests/versioning/test_repository.py
@@ -32,7 +32,7 @@ class TestRepository(fixture.Pathed):
# Can't create it again: it already exists
self.assertRaises(exceptions.PathFoundError, Repository.create, path, name)
return path
-
+
def test_load(self):
"""We should be able to load information about an existing repository"""
# Create a repository to load
@@ -45,7 +45,7 @@ class TestRepository(fixture.Pathed):
# version_table's default isn't none
self.assertNotEquals(repos.config.get('db_settings', 'version_table'), 'None')
-
+
def test_load_notfound(self):
"""Nonexistant repositories shouldn't be loaded"""
path = self.tmp_repos()
@@ -54,7 +54,7 @@ class TestRepository(fixture.Pathed):
def test_load_invalid(self):
"""Invalid repos shouldn't be loaded"""
- # Here, invalid=empty directory. There may be other conditions too,
+ # Here, invalid=empty directory. There may be other conditions too,
# but we shouldn't need to test all of them
path = self.tmp_repos()
os.mkdir(path)
@@ -136,7 +136,7 @@ class TestVersionedRepository(fixture.Pathed):
repos.create_script('')
self.assert_(repos.version(repos.latest) is repos.version())
self.assert_(repos.version() is not None)
-
+
def test_changeset(self):
"""Repositories can create changesets properly"""
# Create a nonzero-version repository of empty scripts
@@ -201,17 +201,17 @@ class TestVersionedRepository(fixture.Pathed):
self.assertEqual(cs.end, 0)
check_changeset((10, 5), 5)
check_changeset((5, 0), 5)
-
+
def test_many_versions(self):
"""Test what happens when lots of versions are created"""
repos = Repository(self.path_repos)
- for i in range(1001):
+ for i in range(1001):
repos.create_script('')
# since we normally create 3 digit ones, let's see if we blow up
self.assert_(os.path.exists('%s/versions/1000.py' % self.path_repos))
self.assert_(os.path.exists('%s/versions/1001.py' % self.path_repos))
-
+
# TODO: test manage file
# TODO: test changeset
diff --git a/migrate/tests/versioning/test_schema.py b/migrate/tests/versioning/test_schema.py
index 7502783..0089c38 100644
--- a/migrate/tests/versioning/test_schema.py
+++ b/migrate/tests/versioning/test_schema.py
@@ -53,7 +53,7 @@ class TestControlledSchema(fixture.Pathed, fixture.DB):
# Trying to create another DB this way fails: table exists
self.assertRaises(exceptions.DatabaseAlreadyControlledError,
ControlledSchema.create, self.engine, self.repos)
-
+
# We can load a controlled DB this way, too
dbcontrol0 = ControlledSchema(self.engine, self.repos)
self.assertEqual(dbcontrol, dbcontrol0)
@@ -67,7 +67,7 @@ class TestControlledSchema(fixture.Pathed, fixture.DB):
dbcontrol0 = ControlledSchema(engine, self.repos.path)
self.assertEqual(dbcontrol, dbcontrol0)
- # Clean up:
+ # Clean up:
dbcontrol.drop()
# Attempting to drop vc from a db without it should fail
@@ -84,7 +84,7 @@ class TestControlledSchema(fixture.Pathed, fixture.DB):
version = 0
dbcontrol = ControlledSchema.create(self.engine, self.repos, version)
self.assertEqual(dbcontrol.version, version)
-
+
# Correct when we load it, too
dbcontrol = ControlledSchema(self.engine, self.repos)
self.assertEqual(dbcontrol.version, version)
@@ -125,7 +125,7 @@ class TestControlledSchema(fixture.Pathed, fixture.DB):
def test_changeset(self):
"""Create changeset from controlled schema"""
dbschema = ControlledSchema.create(self.engine, self.repos)
-
+
# empty schema doesn't have changesets
cs = dbschema.changeset()
self.assertEqual(cs, {})
@@ -143,7 +143,7 @@ class TestControlledSchema(fixture.Pathed, fixture.DB):
@fixture.usedb()
def test_upgrade_runchange(self):
dbschema = ControlledSchema.create(self.engine, self.repos)
-
+
for i in range(10):
self.repos.create_script('')
@@ -184,7 +184,7 @@ class TestControlledSchema(fixture.Pathed, fixture.DB):
dbschema = ControlledSchema.create(self.engine, self.repos)
meta = self.construct_model()
-
+
dbschema.update_db_from_model(meta)
# TODO: test for table version in db
diff --git a/migrate/tests/versioning/test_schemadiff.py b/migrate/tests/versioning/test_schemadiff.py
index 1ff353f..ec6d1dc 100644
--- a/migrate/tests/versioning/test_schemadiff.py
+++ b/migrate/tests/versioning/test_schemadiff.py
@@ -18,7 +18,7 @@ class SchemaDiffBase(fixture.DB):
)
if kw.get('create',True):
self.table.create()
-
+
def _assert_diff(self,col_A,col_B):
self._make_table(col_A)
self.meta.clear()
@@ -43,16 +43,16 @@ class SchemaDiffBase(fixture.DB):
self.name2,
cd.col_B
),str(diff))
-
+
class Test_getDiffOfModelAgainstDatabase(SchemaDiffBase):
name1 = 'model'
name2 = 'database'
-
+
def _run_diff(self,**kw):
return schemadiff.getDiffOfModelAgainstDatabase(
self.meta, self.engine, **kw
)
-
+
@fixture.usedb()
def test_table_missing_in_db(self):
self._make_table(create=False)
@@ -187,7 +187,7 @@ class Test_getDiffOfModelAgainstDatabase(SchemaDiffBase):
Column('data', String(10)),
Column('data', String(20)),
)
-
+
@fixture.usedb()
def test_integer_identical(self):
self._make_table(
@@ -196,7 +196,7 @@ class Test_getDiffOfModelAgainstDatabase(SchemaDiffBase):
diff = self._run_diff()
self.assertEqual('No schema diffs',str(diff))
self.assertFalse(diff)
-
+
@fixture.usedb()
def test_string_identical(self):
self._make_table(
diff --git a/migrate/tests/versioning/test_script.py b/migrate/tests/versioning/test_script.py
index b52ddaa..95ee58c 100644
--- a/migrate/tests/versioning/test_script.py
+++ b/migrate/tests/versioning/test_script.py
@@ -223,7 +223,7 @@ User = Table('User', meta,
f = open(path, 'w')
f.write(contents)
f.close()
-
+
class TestSqlScript(fixture.Pathed, fixture.DB):
diff --git a/migrate/tests/versioning/test_shell.py b/migrate/tests/versioning/test_shell.py
index 0bf5e22..4ba6bce 100644
--- a/migrate/tests/versioning/test_shell.py
+++ b/migrate/tests/versioning/test_shell.py
@@ -52,7 +52,7 @@ class TestShellCommands(Shell):
try:
original = sys.argv
sys.argv=['X','--help']
-
+
run_module('migrate.versioning.shell', run_name='__main__')
finally:
@@ -73,7 +73,7 @@ class TestShellCommands(Shell):
sys.stderr = original
actual = actual.getvalue()
self.assertTrue(expected in actual,'%r not in:\n"""\n%s\n"""'%(expected,actual))
-
+
def test_main(self):
"""Test main() function"""
repos = self.tmp_repos()
@@ -106,7 +106,7 @@ class TestShellCommands(Shell):
result = self.env.run('migrate create %s repository_name' % repos,
expect_error=True)
self.assertEqual(result.returncode, 2)
-
+
def test_script(self):
"""We can create a migration script via the command line"""
repos = self.tmp_repos()
@@ -202,7 +202,7 @@ class TestShellDatabase(Shell, DB):
# we need to connect to the DB to see if things worked
level = DB.CONNECT
-
+
@usedb()
def test_version_control(self):
"""Ensure we can set version control on a database"""
@@ -298,7 +298,7 @@ class TestShellDatabase(Shell, DB):
result = self.env.run('migrate upgrade %s %s' % (self.url, repos_path))
self.assertEqual(self.run_db_version(self.url, repos_path), 1)
-
+
# Downgrade must have a valid version specified
result = self.env.run('migrate downgrade %s %s' % (self.url, repos_path), expect_error=True)
self.assertEqual(result.returncode, 2)
@@ -307,10 +307,10 @@ class TestShellDatabase(Shell, DB):
result = self.env.run('migrate downgrade %s %s 2' % (self.url, repos_path), expect_error=True)
self.assertEqual(result.returncode, 2)
self.assertEqual(self.run_db_version(self.url, repos_path), 1)
-
+
result = self.env.run('migrate downgrade %s %s 0' % (self.url, repos_path))
self.assertEqual(self.run_db_version(self.url, repos_path), 0)
-
+
result = self.env.run('migrate downgrade %s %s 1' % (self.url, repos_path), expect_error=True)
self.assertEqual(result.returncode, 2)
self.assertEqual(self.run_db_version(self.url, repos_path), 0)
@@ -348,7 +348,7 @@ class TestShellDatabase(Shell, DB):
self.assertRaises(Exception, self.engine.text('select * from t_table').execute)
# The tests below are written with some postgres syntax, but the stuff
- # being tested (.sql files) ought to work with any db.
+ # being tested (.sql files) ought to work with any db.
@usedb(supported='postgres')
def test_sqlfile(self):
upgrade_script = """
@@ -362,7 +362,7 @@ class TestShellDatabase(Shell, DB):
"""
self.meta.drop_all()
self._run_test_sqlfile(upgrade_script, downgrade_script)
-
+
@usedb(supported='postgres')
def test_sqlfile_comment(self):
upgrade_script = """
@@ -400,11 +400,11 @@ class TestShellDatabase(Shell, DB):
script_text='''
from sqlalchemy import *
from migrate import *
-
+
def upgrade():
print 'fgsfds'
raise Exception()
-
+
def downgrade():
print 'sdfsgf'
raise Exception()
@@ -425,7 +425,7 @@ class TestShellDatabase(Shell, DB):
from migrate import *
from migrate.changeset import schema
-
+
meta = MetaData(migrate_engine)
account = Table('account', meta,
Column('id', Integer, primary_key=True),
@@ -436,7 +436,7 @@ class TestShellDatabase(Shell, DB):
# Upgrade operations go here. Don't create your own engine; use the engine
# named 'migrate_engine' imported from migrate.
meta.create_all()
-
+
def downgrade():
# Operations to reverse the above upgrade go here.
meta.drop_all()
@@ -447,7 +447,7 @@ class TestShellDatabase(Shell, DB):
result = self.env.run('migrate test %s %s' % (self.url, repos_path))
self.assertEqual(self.run_version(repos_path), 1)
self.assertEqual(self.run_db_version(self.url, repos_path), 0)
-
+
@usedb()
def test_rundiffs_in_shell(self):
# This is a variant of the test_schemadiff tests but run through the shell level.
@@ -542,7 +542,7 @@ class TestShellDatabase(Shell, DB):
## Operations to reverse the above upgrade go here.
#meta.bind = migrate_engine
#tmp_account_rundiffs.drop()''')
-
+
## Save the upgrade script.
#result = self.env.run('migrate script Desc %s' % repos_path)
#upgrade_script_path = '%s/versions/001_Desc.py' % repos_path
diff --git a/migrate/tests/versioning/test_util.py b/migrate/tests/versioning/test_util.py
index b6b1490..db4ea26 100644
--- a/migrate/tests/versioning/test_util.py
+++ b/migrate/tests/versioning/test_util.py
@@ -45,7 +45,7 @@ class TestUtil(fixture.Pathed):
# py 2.4 compatability :-/
cw = catch_warnings(record=True)
w = cw.__enter__()
-
+
warnings.simplefilter("always")
engine = construct_engine(url, echo='True')
self.assertTrue(engine.echo)
@@ -69,7 +69,7 @@ class TestUtil(fixture.Pathed):
api.create(repo, 'temp')
api.script('First Version', repo)
engine = construct_engine('sqlite:///:memory:')
-
+
api.version_control(engine, repo)
api.upgrade(engine, repo)
@@ -103,7 +103,7 @@ class TestUtil(fixture.Pathed):
# py 2.4 compatability :-/
cw = catch_warnings(record=True)
w = cw.__enter__()
-
+
warnings.simplefilter("always")
# deprecated spelling
@@ -117,7 +117,7 @@ class TestUtil(fixture.Pathed):
'model should be in form of module.model:User '
'and not module.model.User',
str(w[-1].message))
-
+
finally:
cw.__exit__()
diff --git a/migrate/tests/versioning/test_version.py b/migrate/tests/versioning/test_version.py
index f521659..25ab2b1 100644
--- a/migrate/tests/versioning/test_version.py
+++ b/migrate/tests/versioning/test_version.py
@@ -68,7 +68,7 @@ class TestVerNum(fixture.Base):
self.assert_(VerNum(1) >= 1)
self.assert_(VerNum(2) >= 1)
self.assertFalse(VerNum(1) >= 2)
-
+
class TestVersion(fixture.Pathed):
@@ -128,11 +128,11 @@ class TestVersion(fixture.Pathed):
def test_selection(self):
"""Verify right sql script is selected"""
-
+
# Create empty directory.
path = self.tmp_repos()
os.mkdir(path)
-
+
# Create files -- files must be present or you'll get an exception later.
python_file = '001_initial_.py'
sqlite_upgrade_file = '001_sqlite_upgrade.sql'
@@ -143,13 +143,13 @@ class TestVersion(fixture.Pathed):
ver = Version(1, path, [sqlite_upgrade_file])
self.assertEqual(os.path.basename(ver.script('sqlite', 'upgrade').path), sqlite_upgrade_file)
-
+
ver = Version(1, path, [default_upgrade_file])
self.assertEqual(os.path.basename(ver.script('default', 'upgrade').path), default_upgrade_file)
-
+
ver = Version(1, path, [sqlite_upgrade_file, default_upgrade_file])
self.assertEqual(os.path.basename(ver.script('sqlite', 'upgrade').path), sqlite_upgrade_file)
-
+
ver = Version(1, path, [sqlite_upgrade_file, default_upgrade_file, python_file])
self.assertEqual(os.path.basename(ver.script('postgres', 'upgrade').path), default_upgrade_file)