Hi,
That's an interesting problem :)
An option would be to declare the session in a separate file, imported from both — typically a ``scoped_session`` as
you pointed.
If both modules are using, say, ``from . import testing; session = testing.SharedSession()`` where testing.SharedSession is defined through
``scoped_session``, then you would be using the *same* session in both modules.
Another option would be to push on issue
https://github.com/rbarrois/factory_boy/issues/304, where we're considering accepting a callable
for the sqlalchemy_session parameter — that getter could then lazily load the session used by your testrunner.
Cheers,
--
Raphaël