Ejemplo n.º 1
0
 def setUp(self):
     global Base, Session, Versioned
     Base = declarative_base(bind=engine)
     Session = sessionmaker()
     versioned_session(Session)
Ejemplo n.º 2
0
 def setUp(self):
     self.session = Session(engine)
     self.Base = declarative_base()
     versioned_session(self.session)
Ejemplo n.º 3
0
 def setUp(self):
     global Base, Session, Versioned
     Base = declarative_base()
     Session = sessionmaker(engine)
     versioned_session(Session)
Ejemplo n.º 4
0
import unittest

from sqlalchemy import create_engine, Column, Integer, String
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker

from history_meta import Versioned, versioned_session


engine = create_engine('sqlite:///:memory:', echo=True)
Base = declarative_base()
Session = sessionmaker(bind=engine)
versioned_session(Session)


class Document(Versioned, Base):
    __tablename__ = 'document'
    id = Column(Integer, primary_key=True, autoincrement=True)
    name = Column(String, nullable=True)
    description_ = Column('description', String, nullable=True)


DocumentHistory = Document.__history_mapper__.class_


Base.metadata.create_all(engine)


class VersionedTest(unittest.TestCase):

    def test_create_double_flush(self):