Skip to content

Instantly share code, notes, and snippets.

@rbarrois
Created February 6, 2015 20:30
Show Gist options
  • Save rbarrois/659159a3fd3f5fddffe6 to your computer and use it in GitHub Desktop.
Save rbarrois/659159a3fd3f5fddffe6 to your computer and use it in GitHub Desktop.
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