Created
February 6, 2015 20:30
-
-
Save rbarrois/659159a3fd3f5fddffe6 to your computer and use it in GitHub Desktop.
WIP: API for factory_boy / SQLAlchemy's session
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import factory.alchemy | |
session_loader = factory.alchemy.SQLAlchemySessionLoader() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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