def boot_shell(options, initial=True): bootstrap = ShellBootstrap(options=options, initial=initial) bootstrap.bootstrap() # We can now import Shell which can import any dependencies it like, # as all should be configured properly at this point from stoq.gui.shell.shell import Shell shell = Shell(bootstrap, options) return shell
def prepare_test(self): """Prepares to run a standalone test. This initializes Stoq and creates a store and returns an example creator. :returns: an :py:class:`~stoqlib.domain.exampledata.ExampleCreator` """ # FIXME: We need to move this into stoqlib from stoq.gui.shell.shell import Shell from stoq.lib.options import get_option_parser parser = get_option_parser() options = parser.parse_args(sys.argv[1:])[0] options.wizard = False options.splashscreen = False options.login_username = u'admin' shell = Shell(options, initial=False) shell._bootstrap.bootstrap() shell._do_login() from stoqlib.domain.exampledata import ExampleCreator ec = ExampleCreator() store = self.new_store() ec.set_store(store) return ec