Commits

Ronny Pfannschmidt committed d2342db

tox clean

Comments (0)

Files changed (6)

micromigrate/backend_base.py

+from .types import MigrationError
 from .constants import (
     HAS_MIGRATIONS,
     MIGRATIONS_AND_CHECKSUMS,
+    MIGRATION_SCRIPT,
 )
 
-from .constants import MIGRATION_SCRIPT
-from .types import MigrationError
 
 class BackendBase(object):
 
     def run_script(self, script):
         raise NotImplementedError
 
-
     def apply(self, migration):
         script = MIGRATION_SCRIPT.format(migration=migration)
         try:

micromigrate/backend_pysqlite.py

 import sqlite3
 
 from .backend_base import BackendBase
-from .constants import MIGRATION_SCRIPT
-from .types import MigrationError
 from sqlparse import split
 
+
 class PySqliteBackend(BackendBase):
+
     def __init__(self, dbname):
         self.connection = sqlite3.connect(str(dbname), isolation_level=None)
         self.connection.row_factory = sqlite3.Row
         c = self.connection.cursor()
         try:
             for statement in split(script):
-                c.execute(statement);
+                c.execute(statement)
         except:
             c.execute('rollback')
             raise
+
     def run_query(self, query):
         c = self.connection.cursor()
         return c.execute(query).fetchall()

micromigrate/backend_script.py

 
     def __repr__(self):
         return '<ScriptBackend %r>' % (self.dbname,)
-    
+
     def run_script(self, script):
         self.run_query(script)
 

testing/conftest.py

     'binding': PySqliteBackend,
 }
 
+
 @pytest.fixture
 def dbname(request, tmpdir):
     db = tmpdir.join('test.sqlite.db')

testing/test_miromigrate.py

 from micromigrate import MigrationError
 
 
-
 def test_parse_migration():
     result = parse_migration("-- migration test")
     assert result.name == 'test'
 deps =
     hgdistver
     pytest
+    sqlparse
 commands = py.test []
 
 [testenv:codechecks]