Commits

Ronny Pfannschmidt committed 3b638ac

flake8 fixes

Comments (0)

Files changed (2)

micromigrate/migrate.py

 from collections import namedtuple
 import subprocess
 
+
 class Migration(namedtuple('MigrationBase', 'name checksum sql after')):
     __slots__ = ()
 
     return Migration(**meta)
 
 
-MIGRATION_SCRIPT="""
+MIGRATION_SCRIPT = """
 begin transaction;;
 
 create table if not exists micromigrate_migrations (
 commit;
 """
 
+
 def runsqlite(dbname, script):
     subprocess.check_call([
         'sqlite3', '-line',
         str(dbname), script,
     ])
 
+
 def runquery(dbname, query):
     proc = subprocess.Popen(
         ['sqlite3', '-line', str(dbname), query],
-        stdout = subprocess.PIPE,
+        stdout=subprocess.PIPE,
         universal_newlines=True,
     )
     out, ignored = proc.communicate()
     if proc.returncode:
         raise Exception(proc.returncode)
-    
+
     chunks = out.split('\n\n')
     return [
         dict(x.strip().split(' = ') for x in chunk.splitlines())
         pass
     return migration_state(dbname)
 
+
 def migration_state(dbname):
     proc = '''select name, type
         from sqlite_master
             for row in runquery(dbname, listit))
 
 
-
 def verify_state(state, migrations):
     missing = []
     for migration in migrations:

testing/test_miromigrate.py

 @pytest.fixture
 def dbname(request, tmpdir):
     db = tmpdir.join('test.sqlite.db')
+
     @request.addfinalizer
     def cleanup():
         import subprocess
     state = mm.migration_state(dbname)
     assert state == {'test': migration.checksum}
 
+
 def test_migration_initial(dbname):
     state = mm.migration_state(dbname)
     assert state is None
     assert new_state[migration.name] == migration.checksum
 
 
-
-
 def test_boken_transaction(dbname):
     migration = mm.parse_migration(u"""
         -- migration broke