Exemplo n.º 1
0
 def setup_class(cls):
     cls.bind = config.db
     cls.conn = cls.bind.connect()
     staging_env()
     cls.migration_context = MigrationContext.configure(
         connection=cls.conn, opts={"compare_type": True, "compare_server_default": True}
     )
Exemplo n.º 2
0
    def setUp(self):
        staging_env()
        self.bind = eng = engines.testing_engine()

        def unimpl(*arg, **kw):
            raise NotImplementedError()
        eng.dialect.get_unique_constraints = unimpl
Exemplo n.º 3
0
    def setUp(self):
        staging_env()
        self.cfg = cfg = _no_sql_testing_config()

        self.rid = rid = util.rev_id()

        self.script = script = ScriptDirectory.from_config(cfg)
        script.generate_revision(rid, None, refresh=True)
Exemplo n.º 4
0
    def setup_class(cls):
        staging_env()
        if util.sqla_105:
            directives = "sqlalchemy.legacy_schema_aliasing=false"
        else:
            directives = ""
        cls.cfg = cfg = _no_sql_testing_config("mssql", directives)

        cls.a, cls.b, cls.c = three_rev_fixture(cfg)
Exemplo n.º 5
0
 def setup_class(cls):
     cls.bind = config.db
     staging_env()
     cls.migration_context = MigrationContext.configure(
         connection=cls.bind.connect(),
         opts={
             'compare_type': True,
             'compare_server_default': True
         }
     )
Exemplo n.º 6
0
 def setup_class(cls):
     cls.bind = config.db
     staging_env()
     context = MigrationContext.configure(
         connection=cls.bind.connect(),
         opts={"compare_type": True, "compare_server_default": True},
     )
     connection = context.bind
     cls.autogen_context = {
         "imports": set(),
         "connection": connection,
         "dialect": connection.dialect,
         "context": context,
     }
Exemplo n.º 7
0
    def setUp(self):
        self.env = staging_env()
        self.cfg = cfg = _no_sql_testing_config()
        cfg.set_main_option('dialect_name', 'sqlite')
        cfg.remove_main_option('url')

        self.a, self.b, self.c = three_rev_fixture(cfg)
Exemplo n.º 8
0
    def setup_class(cls):
        cls.env = env = staging_env()
        cls.a = env.generate_revision(util.rev_id(), "->a")
        cls.b = env.generate_revision(util.rev_id(), "a->b")

        cls.c1 = env.generate_revision(util.rev_id(), "b->c1")
        cls.d1 = env.generate_revision(util.rev_id(), "c1->d1")

        cls.c2 = env.generate_revision(
            util.rev_id(),
            "b->c2",
            branch_labels="c2branch",
            head=cls.b.revision,
            splice=True,
        )
        cls.d2 = env.generate_revision(
            util.rev_id(), "c2->d2", head=cls.c2.revision
        )

        cls.e = env.generate_revision(
            util.rev_id(),
            "merge d1 and d2",
            head=(cls.d1.revision, cls.d2.revision),
        )

        cls.f = env.generate_revision(util.rev_id(), "e->f")
Exemplo n.º 9
0
    def setup_class(cls):
        cls.env = env = staging_env()
        cls.a1 = env.generate_revision(
            util.rev_id(), "->a1", branch_labels=["lib1"]
        )
        cls.b1 = env.generate_revision(util.rev_id(), "a1->b1")
        cls.c1 = env.generate_revision(
            util.rev_id(), "b1->c1", branch_labels=["c1lib"]
        )

        cls.a2 = env.generate_revision(util.rev_id(), "->a2", head=())
        cls.b2 = env.generate_revision(
            util.rev_id(), "a2->b2", head=cls.a2.revision
        )
        cls.c2 = env.generate_revision(
            util.rev_id(), "b2->c2", head=cls.b2.revision, depends_on=["c1lib"]
        )

        cls.d1 = env.generate_revision(
            util.rev_id(), "c1->d1", head=cls.c1.revision
        )
        cls.e1 = env.generate_revision(
            util.rev_id(), "d1->e1", head=cls.d1.revision
        )
        cls.f1 = env.generate_revision(
            util.rev_id(), "e1->f1", head=cls.e1.revision
        )
Exemplo n.º 10
0
    def setup_class(cls):
        """
        issue #377

        Structure::

            <base> -> a1 --+--> a2 -------> a3
                           |     ^          |
                           |     |   +------+
                           |     |   |
                           |     +---|------+
                           |         |      |
                           |         v      |
                           +-------> b1 --> b2 --> b3

        """
        cls.env = env = staging_env()
        cls.a1 = env.generate_revision("a1", "->a1", head="base")
        cls.a2 = env.generate_revision("a2", "->a2")

        cls.b1 = env.generate_revision("b1", "->b1", head="base")
        cls.b2 = env.generate_revision(
            "b2", "->b2", depends_on="a2", head="b1"
        )
        cls.b3 = env.generate_revision("b3", "->b3", head="b2")

        cls.a3 = env.generate_revision(
            "a3", "->a3", head="a2", depends_on="b1"
        )
Exemplo n.º 11
0
    def setup_class(cls):
        """
        A -> B2 (branchpoint),

        B1, B2 -> C1 (mergepoint)
        B2, B3 -> C2 (mergepoint)

        C1 -> D1 (head),

        C2 -> D2 (head),


        """
        cls.env = env = staging_env()

        cls.a = env.generate_revision("a", "a")
        cls.b1 = env.generate_revision("b1", "b1", head=cls.a.revision)
        cls.b2 = env.generate_revision(
            "b2", "b2", splice=True, head=cls.a.revision
        )
        cls.b3 = env.generate_revision(
            "b3", "b3", splice=True, head=cls.a.revision
        )

        cls.c1 = env.generate_revision(
            "c1", "c1", head=(cls.b1.revision, cls.b2.revision)
        )

        cls.c2 = env.generate_revision(
            "c2", "c2", splice=True, head=(cls.b2.revision, cls.b3.revision)
        )

        cls.d1 = env.generate_revision("d1", "d1", head=cls.c1.revision)

        cls.d2 = env.generate_revision("d2", "d2", head=cls.c2.revision)
Exemplo n.º 12
0
 def setup_class(cls):
     cls.env = env = staging_env()
     cls.a = env.generate_revision(util.rev_id(), "->a")
     cls.b = env.generate_revision(util.rev_id(), "a->b")
     cls.c = env.generate_revision(util.rev_id(), "b->c")
     cls.d = env.generate_revision(util.rev_id(), "c->d")
     cls.e = env.generate_revision(util.rev_id(), "d->e")
Exemplo n.º 13
0
    def setup_class(cls):
        cls.env = env = staging_env()
        cls.a1 = env.generate_revision(util.rev_id(), "->a1")
        cls.b1 = env.generate_revision(util.rev_id(), "a1->b1")
        cls.c1 = env.generate_revision(util.rev_id(), "b1->c1")

        cls.a2 = env.generate_revision(
            util.rev_id(), "->a2", head=(), refresh=True
        )
        cls.b2 = env.generate_revision(
            util.rev_id(), "a2->b2", head=cls.a2.revision
        )
        cls.c2 = env.generate_revision(
            util.rev_id(), "b2->c2", head=cls.b2.revision
        )

        # mergepoint between c1, c2
        # d1 dependent on c2
        cls.d1 = env.generate_revision(
            util.rev_id(),
            "d1",
            head=(cls.c1.revision, cls.c2.revision),
            refresh=True,
        )

        # but then c2 keeps going into d2
        cls.d2 = env.generate_revision(
            util.rev_id(),
            "d2",
            head=cls.c2.revision,
            refresh=True,
            splice=True,
        )
Exemplo n.º 14
0
    def setUp(self):
        self.bind = _sqlite_file_db()
        self.env = staging_env()
        self.cfg = _sqlite_testing_config()
        self.a = a = util.rev_id()
        self.b = b = util.rev_id()
        script = ScriptDirectory.from_config(self.cfg)
        script.generate_revision(a, None, refresh=True)
        write_script(
            script,
            a,
            """
revision = '%s'
down_revision = None
"""
            % a,
        )
        script.generate_revision(b, None, refresh=True)
        write_script(
            script,
            b,
            """
revision = '%s'
down_revision = '%s'
"""
            % (b, a),
        )
Exemplo n.º 15
0
    def setup_class(cls):
        cls.env = env = staging_env()
        cls.a1 = env.generate_revision(
            util.rev_id(), '->a1',
            branch_labels=['lib1'])
        cls.b1 = env.generate_revision(util.rev_id(), 'a1->b1')
        cls.c1 = env.generate_revision(
            util.rev_id(), 'b1->c1',
            branch_labels=['c1lib'])

        cls.a2 = env.generate_revision(util.rev_id(), '->a2', head=())
        cls.b2 = env.generate_revision(
            util.rev_id(), 'a2->b2', head=cls.a2.revision)
        cls.c2 = env.generate_revision(
            util.rev_id(), 'b2->c2', head=cls.b2.revision,
            depends_on=['c1lib'])

        cls.d1 = env.generate_revision(
            util.rev_id(), 'c1->d1',
            head=cls.c1.revision)
        cls.e1 = env.generate_revision(
            util.rev_id(), 'd1->e1',
            head=cls.d1.revision)
        cls.f1 = env.generate_revision(
            util.rev_id(), 'e1->f1',
            head=cls.e1.revision)
Exemplo n.º 16
0
    def setUp(self):
        self.env = staging_env()
        self.cfg = _multi_dir_testing_config()
        self.cfg.set_main_option("revision_environment", "true")

        script = ScriptDirectory.from_config(self.cfg)
        # MARKMARK
        self.model1 = util.rev_id()
        self.model2 = util.rev_id()
        self.model3 = util.rev_id()
        for model, name in [
            (self.model1, "model1"),
            (self.model2, "model2"),
            (self.model3, "model3"),
        ]:
            script.generate_revision(
                model, name, refresh=True,
                version_path=os.path.join(_get_staging_directory(), name),
                head="base")

            write_script(script, model, """\
"%s"
revision = '%s'
down_revision = None
branch_labels = ['%s']

from alembic import op

def upgrade():
    pass

def downgrade():
    pass

""" % (name, model, name))
    def setup_class(cls):
        cls.env = env = staging_env()
        cls.a1 = env.generate_revision(util.rev_id(), '->a1', head='base')
        cls.a2 = env.generate_revision(util.rev_id(), '->a2', head='base')
        cls.a3 = env.generate_revision(util.rev_id(), '->a3', head='base')
        cls.amerge = env.generate_revision(util.rev_id(), 'amerge', head=[
            cls.a1.revision, cls.a2.revision, cls.a3.revision
        ])

        cls.b1 = env.generate_revision(util.rev_id(), '->b1', head='base')
        cls.b2 = env.generate_revision(util.rev_id(), '->b2', head='base')
        cls.bmerge = env.generate_revision(util.rev_id(), 'bmerge', head=[
            cls.b1.revision, cls.b2.revision
        ])

        cls.c1 = env.generate_revision(util.rev_id(), '->c1', head='base')
        cls.c2 = env.generate_revision(util.rev_id(), '->c2', head='base')
        cls.c3 = env.generate_revision(util.rev_id(), '->c3', head='base')
        cls.cmerge = env.generate_revision(util.rev_id(), 'cmerge', head=[
            cls.c1.revision, cls.c2.revision, cls.c3.revision
        ])

        cls.d1 = env.generate_revision(
            util.rev_id(), 'overmerge',
            head="base",
            depends_on=[
                cls.a3.revision, cls.b2.revision, cls.c1.revision
            ])
 def setup_class(cls):
     cls.env = env = staging_env()
     cls.a = env.generate_revision(util.rev_id(), '->a')
     cls.b = env.generate_revision(util.rev_id(), 'a->b')
     cls.c = env.generate_revision(util.rev_id(), 'b->c')
     cls.d = env.generate_revision(util.rev_id(), 'c->d')
     cls.e = env.generate_revision(util.rev_id(), 'd->e')
Exemplo n.º 19
0
    def setUp(self):
        self.env = staging_env()
        self.cfg = cfg = _no_sql_testing_config()
        cfg.set_main_option("dialect_name", "sqlite")
        cfg.remove_main_option("url")
        self.a = util.rev_id()
        script = ScriptDirectory.from_config(cfg)
        script.generate_revision(self.a, "revision a", refresh=True)
        write_script(
            script,
            self.a,
            (
                compat.u(
                    """# coding: utf-8
from __future__ import unicode_literals
revision = '%s'
down_revision = None

from alembic import op

def upgrade():
    op.execute("« S’il vous plaît…")

def downgrade():
    op.execute("drôle de petite voix m’a réveillé")

"""
                )
                % self.a
            ),
            encoding="utf-8",
        )
Exemplo n.º 20
0
 def setup_class(cls):
     cls.bind = config.db
     staging_env()
     context = MigrationContext.configure(
         connection=cls.bind.connect(),
         opts={
             'compare_type': True,
             'compare_server_default': True
         }
     )
     connection = context.bind
     cls.autogen_context = {
         'imports': set(),
         'connection': connection,
         'dialect': connection.dialect,
         'context': context
     }
Exemplo n.º 21
0
    def _opened_transaction_fixture(self):
        self.env = staging_env()
        self.cfg = _sqlite_testing_config()

        script = ScriptDirectory.from_config(self.cfg)
        a = util.rev_id()
        b = util.rev_id()
        c = util.rev_id()
        script.generate_revision(a, "revision a", refresh=True)
        write_script(script, a, """
"rev a"

revision = '%s'
down_revision = None

def upgrade():
    pass

def downgrade():
    pass

""" % (a, ))
        script.generate_revision(b, "revision b", refresh=True)
        write_script(script, b, """
"rev b"
revision = '%s'
down_revision = '%s'

from alembic import op


def upgrade():
    conn = op.get_bind()
    trans = conn.begin()


def downgrade():
    pass

""" % (b, a))
        script.generate_revision(c, "revision c", refresh=True)
        write_script(script, c, """
"rev c"
revision = '%s'
down_revision = '%s'

from alembic import op


def upgrade():
    pass


def downgrade():
    pass

""" % (c, b))
        return a, b, c
Exemplo n.º 22
0
 def setup_class(cls):
     cls.env = env = staging_env()
     cls.cfg = _sqlite_testing_config()
     cls.a1 = env.generate_revision("a1", "a1")
     cls.a2 = env.generate_revision("a2", "a2")
     cls.a3 = env.generate_revision("a3", "a3")
     cls.b1 = env.generate_revision("b1", "b1", head="base")
     cls.b2 = env.generate_revision("b2", "b2", head="b1", depends_on="a2")
     cls.b3 = env.generate_revision("b3", "b3", head="b2")
    def setup_class(cls):
        cls.env = env = staging_env()
        cls.a1 = env.generate_revision(util.rev_id(), '->a1')
        cls.b1 = env.generate_revision(util.rev_id(), 'a1->b1')

        cls.a2 = env.generate_revision(
            util.rev_id(), '->a2', head=(),
            refresh=True)
        cls.b2 = env.generate_revision(
            util.rev_id(), 'a2->b2', head=cls.a2.revision)
Exemplo n.º 24
0
    def setup_class(cls):
        """
        a1 ---+
              |
        a2 ---+--> amerge
              |
        a3 ---+
         ^
         |
         +---------------------------+
                                     |
        b1 ---+                      |
              +--> bmerge        overmerge / d1
        b2 ---+                     |  |
         ^                          |  |
         |                          |  |
         +--------------------------+  |
                                       |
         +-----------------------------+
         |
         v
        c1 ---+
              |
        c2 ---+--> cmerge
              |
        c3 ---+

        """
        cls.env = env = staging_env()
        cls.a1 = env.generate_revision("a1", '->a1', head='base')
        cls.a2 = env.generate_revision("a2", '->a2', head='base')
        cls.a3 = env.generate_revision("a3", '->a3', head='base')
        cls.amerge = env.generate_revision("amerge", 'amerge', head=[
            cls.a1.revision, cls.a2.revision, cls.a3.revision
        ])

        cls.b1 = env.generate_revision("b1", '->b1', head='base')
        cls.b2 = env.generate_revision("b2", '->b2', head='base')
        cls.bmerge = env.generate_revision("bmerge", 'bmerge', head=[
            cls.b1.revision, cls.b2.revision
        ])

        cls.c1 = env.generate_revision("c1", '->c1', head='base')
        cls.c2 = env.generate_revision("c2", '->c2', head='base')
        cls.c3 = env.generate_revision("c3", '->c3', head='base')
        cls.cmerge = env.generate_revision("cmerge", 'cmerge', head=[
            cls.c1.revision, cls.c2.revision, cls.c3.revision
        ])

        cls.d1 = env.generate_revision(
            "d1", 'o',
            head="base",
            depends_on=[
                cls.a3.revision, cls.b2.revision, cls.c1.revision
            ])
Exemplo n.º 25
0
    def setUp(self):
        self.engine1 = _sqlite_file_db(tempname='eng1.db')
        self.engine2 = _sqlite_file_db(tempname='eng2.db')
        self.engine3 = _sqlite_file_db(tempname='eng3.db')

        self.env = staging_env(template="multidb")
        self.cfg = _multidb_testing_config({
            "engine1": self.engine1,
            "engine2": self.engine2,
            "engine3": self.engine3
        })
Exemplo n.º 26
0
    def _test_006_from_clean_env(self):
        # test the environment so far with a
        # new ScriptDirectory instance.

        env = staging_env(create=False)
        abc_rev = env.get_revision(abc)
        def_rev = env.get_revision(def_)
        eq_(abc_rev.nextrev, set([def_]))
        eq_(abc_rev.revision, abc)
        eq_(def_rev.down_revision, abc)
        eq_(env.get_heads(), [def_])
        eq_(env.get_base(), abc)
    def setup_class(cls):
        """

        33e21c000cfe -> 178d4e761bbd (head),
        2bef33cb3a58, 3904558db1c6, 968330f320d -> 33e21c000cfe (mergepoint)
        46c99f866004 -> 18f46b42410d (head),
        2bef33cb3a58, 3904558db1c6, 968330f320d -> 46c99f866004 (mergepoint)
        f0fa4315825 -> 3904558db1c6 (branchpoint),

        --------------------------

        A -> B2 (branchpoint),

        B1, B2, B3 -> C1 (mergepoint)
        B1, B2, B3 -> C2 (mergepoint)

        C1 -> D1 (head),

        C2 -> D2 (head),


        """
        cls.env = env = staging_env()

        cls.a = env.generate_revision(
            'a', 'a'
        )
        cls.b1 = env.generate_revision('b1', 'b1',
                                       head=cls.a.revision)
        cls.b2 = env.generate_revision('b2', 'b2',
                                       splice=True,
                                       head=cls.a.revision)
        cls.b3 = env.generate_revision('b3', 'b3',
                                       splice=True,
                                       head=cls.a.revision)

        cls.c1 = env.generate_revision(
            'c1', 'c1',
            head=(cls.b1.revision, cls.b2.revision, cls.b3.revision))

        cls.c2 = env.generate_revision(
            'c2', 'c2',
            splice=True,
            head=(cls.b1.revision, cls.b2.revision, cls.b3.revision))

        cls.d1 = env.generate_revision(
            'd1', 'd1', head=cls.c1.revision)

        cls.d2 = env.generate_revision(
            'd2', 'd2', head=cls.c2.revision)
Exemplo n.º 28
0
 def setup_class(cls):
     cls.bind = config.db
     staging_env()
     context = MigrationContext.configure(
         connection=cls.bind.connect(),
         opts={
             'compare_type': True,
             'compare_server_default': True
         }
     )
     connection = context.bind
     cls.autogen_context = {
         'imports': set(),
         'connection': connection,
         'dialect': connection.dialect,
         'context': context,
         'opts': {
             'compare_type': True,
             'compare_server_default': True,
             'alembic_module_prefix': 'op.',
             'sqlalchemy_module_prefix': 'sa.',
         }
     }
    def setup_class(cls):
        cls.env = env = staging_env()
        cls.a = env.generate_revision(util.rev_id(), '->a')
        cls.b = env.generate_revision(util.rev_id(), 'a->b')

        cls.c1 = env.generate_revision(
            util.rev_id(), 'b->c1',
            branch_labels='c1branch',
            refresh=True)
        cls.d1 = env.generate_revision(util.rev_id(), 'c1->d1')

        cls.c2 = env.generate_revision(
            util.rev_id(), 'b->c2',
            branch_labels='c2branch',
            head=cls.b.revision, splice=True)
        cls.d2 = env.generate_revision(
            util.rev_id(), 'c2->d2',
            head=cls.c2.revision)
Exemplo n.º 30
0
    def setup_class(cls):
        cls.env = env = staging_env()
        cls.a = env.generate_revision(util.rev_id(), "->a")
        cls.b = env.generate_revision(util.rev_id(), "a->b")

        cls.c1 = env.generate_revision(
            util.rev_id(), "b->c1", branch_labels="c1branch", refresh=True
        )
        cls.d1 = env.generate_revision(util.rev_id(), "c1->d1")

        cls.c2 = env.generate_revision(
            util.rev_id(),
            "b->c2",
            branch_labels="c2branch",
            head=cls.b.revision,
            splice=True,
        )
        cls.d2 = env.generate_revision(
            util.rev_id(), "c2->d2", head=cls.c2.revision
        )
Exemplo n.º 31
0
    def setup_class(cls):
        staging_env()
        directives = "sqlalchemy.legacy_schema_aliasing=false"
        cls.cfg = cfg = _no_sql_testing_config("mssql", directives)

        cls.a, cls.b, cls.c = three_rev_fixture(cfg)
 def setUp(self):
     self.env = staging_env(sourceless=False)
     self.cfg = _sqlite_testing_config()
Exemplo n.º 33
0
 def setUp(self):
     staging_env()
     self.cfg = _no_sql_testing_config()
Exemplo n.º 34
0
    def _opened_transaction_fixture(self, future=False):
        self.env = staging_env()

        if future:
            self.cfg = _sqlite_testing_config(future=future)
        else:
            self.cfg = _sqlite_testing_config()

        if self.branched_connection:
            self._branched_connection_env()

        script = ScriptDirectory.from_config(self.cfg)
        a = util.rev_id()
        b = util.rev_id()
        c = util.rev_id()

        script.generate_revision(a, "revision a", refresh=True)
        write_script(
            script,
            a,
            """
"rev a"

revision = '%s'
down_revision = None

def upgrade():
    pass

def downgrade():
    pass

"""
            % (a,),
        )
        script.generate_revision(b, "revision b", refresh=True)
        write_script(
            script,
            b,
            """
"rev b"
revision = '%s'
down_revision = '%s'

from alembic import op


def upgrade():
    conn = op.get_bind()
    # this should fail for a SQLAlchemy 2.0 connection b.c. there is
    # already a transaction.
    trans = conn.begin()


def downgrade():
    pass

"""
            % (b, a),
        )
        script.generate_revision(c, "revision c", refresh=True)
        write_script(
            script,
            c,
            """
"rev c"
revision = '%s'
down_revision = '%s'

from alembic import op


def upgrade():
    pass


def downgrade():
    pass

"""
            % (c, b),
        )
        return a, b, c
Exemplo n.º 35
0
 def setup_class(cls):
     cls.env = staging_env()
     cls.cfg = _sqlite_testing_config()
     cls.a, cls.b, cls.c = three_rev_fixture(cls.cfg)
Exemplo n.º 36
0
 def setup_class(cls):
     staging_env()
     cls.bind = cls._get_bind()
     cls.m1 = cls._get_db_schema()
     cls.m1.create_all(cls.bind)
     cls.m2 = cls._get_model_schema()
Exemplo n.º 37
0
 def setup_class(cls):
     cls.bind = config.db
     staging_env()
    def setup_class(cls):
        """
        Structure::

            a1 ---+
                  |
            a2 ---+--> amerge
                  |
            a3 ---+
             ^
             |
             +---------------------------+
                                         |
            b1 ---+                      |
                  +--> bmerge        overmerge / d1
            b2 ---+                     |  |
             ^                          |  |
             |                          |  |
             +--------------------------+  |
                                           |
             +-----------------------------+
             |
             v
            c1 ---+
                  |
            c2 ---+--> cmerge
                  |
            c3 ---+

        """
        cls.env = env = staging_env()
        cls.a1 = env.generate_revision("a1", "->a1", head="base")
        cls.a2 = env.generate_revision("a2", "->a2", head="base")
        cls.a3 = env.generate_revision("a3", "->a3", head="base")
        cls.amerge = env.generate_revision(
            "amerge",
            "amerge",
            head=[cls.a1.revision, cls.a2.revision, cls.a3.revision],
        )

        cls.b1 = env.generate_revision("b1", "->b1", head="base")
        cls.b2 = env.generate_revision("b2", "->b2", head="base")
        cls.bmerge = env.generate_revision(
            "bmerge", "bmerge", head=[cls.b1.revision, cls.b2.revision]
        )

        cls.c1 = env.generate_revision("c1", "->c1", head="base")
        cls.c2 = env.generate_revision("c2", "->c2", head="base")
        cls.c3 = env.generate_revision("c3", "->c3", head="base")
        cls.cmerge = env.generate_revision(
            "cmerge",
            "cmerge",
            head=[cls.c1.revision, cls.c2.revision, cls.c3.revision],
        )

        cls.d1 = env.generate_revision(
            "d1",
            "o",
            head="base",
            depends_on=[cls.a3.revision, cls.b2.revision, cls.c1.revision],
        )
Exemplo n.º 39
0
 def setUp(self):
     self.env = staging_env()
     self.cfg = _sqlite_testing_config()
     self.a, self.b, self.c = three_rev_fixture(self.cfg)
 def setUp(self):
     self.bind = _sqlite_file_db()
     self.env = staging_env(sourceless=self.sourceless)
     self.cfg = _sqlite_testing_config(sourceless=self.sourceless)
Exemplo n.º 41
0
 def setUp(self):
     global env
     env = staging_env()
Exemplo n.º 42
0
 def setUp(self):
     self.env = staging_env()
     self.cfg = _sqlite_testing_config()
Exemplo n.º 43
0
 def setUp(self):
     self.env = staging_env()
     self.cfg = _multi_dir_testing_config()
Exemplo n.º 44
0
    def setUp(self):
        staging_env()
        self.cfg = _no_sql_testing_config()

        global a, b, c
        a, b, c = three_rev_fixture(self.cfg)
Exemplo n.º 45
0
 def setUp(self):
     self.env = staging_env()
Exemplo n.º 46
0
    def setup_class(cls):
        staging_env()
        cls.cfg = cfg = _no_sql_testing_config("mssql")

        cls.a, cls.b, cls.c = \
            three_rev_fixture(cfg)
Exemplo n.º 47
0
 def setUp(self):
     staging_env()
     self.bind = config.db
    def _opened_transaction_fixture(self):
        self.env = staging_env()
        self.cfg = _sqlite_testing_config()

        script = ScriptDirectory.from_config(self.cfg)
        a = util.rev_id()
        b = util.rev_id()
        c = util.rev_id()
        script.generate_revision(a, "revision a", refresh=True)
        write_script(
            script, a, """
"rev a"

revision = '%s'
down_revision = None

def upgrade():
    pass

def downgrade():
    pass

""" % (a, ))
        script.generate_revision(b, "revision b", refresh=True)
        write_script(
            script, b, """
"rev b"
revision = '%s'
down_revision = '%s'

from alembic import op


def upgrade():
    conn = op.get_bind()
    trans = conn.begin()


def downgrade():
    pass

""" % (b, a))
        script.generate_revision(c, "revision c", refresh=True)
        write_script(
            script, c, """
"rev c"
revision = '%s'
down_revision = '%s'

from alembic import op


def upgrade():
    pass


def downgrade():
    pass

""" % (c, b))
        return a, b, c
Exemplo n.º 49
0
 def setUp(self):
     staging_env()
     self.cfg = _no_sql_testing_config(
         directives="\nrevision_environment=true\n")