Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
WIP: API for factory_boy / SQLAlchemy's session
import factory
import factory.alchemy
import my_tests
import my_models
class MyFactory(factory.alchemy.SQLAlchemyFactory):
class Meta:
sqlalchemy_session_loader = my_tests.session_loader
model = my_models.Model
import factory.alchemy
session_loader = factory.alchemy.SQLAlchemySessionLoader()
import my_tests
class MyRunner():
def prepare(self):
self.session = make_an_alchemy_session()
my_tests.session_loader.set_session(self.session)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment