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.bootstrap import boot_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.autoreload = False options.login_username = u'admin' options.non_fatal_warnings = False shell = boot_shell(options, initial=False) shell._dbconn.connect() shell._do_login() from stoqlib.domain.exampledata import ExampleCreator ec = ExampleCreator() store = self.new_store() ec.set_store(store) return ec
def get_shell(args): log.info('parsing command line arguments: %s ' % (args, )) from stoq.lib.options import get_option_parser parser = get_option_parser() group = optparse.OptionGroup(parser, 'Stoq') group.add_option('-A', '--autoreload', action="store_true", dest="autoreload", help='Autoreload application when source is modified') group.add_option('', '--fatal-warnings', action="store_false", dest="non_fatal_warnings", default=True, help='Make all warnings fatal') group.add_option('', '--login-username', action="store", dest="login_username", default=None, help='Username to login to stoq with') group.add_option('', '--no-splash-screen', action="store_false", dest="splashscreen", default=True, help='Disable the splash screen') group.add_option('', '--version', action="store_true", dest="version", help='Show the application version') group.add_option('', '--wizard', action="store_true", dest="wizard", default=None, help='Run the wizard') parser.add_option_group(group) options, args = parser.parse_args(args) if options.version: import stoq print(stoq.version) raise SystemExit() from stoq.gui.shell.bootstrap import boot_shell shell = boot_shell(options) return args, shell
def get_shell(args): log.info('parsing command line arguments: %s ' % (args, )) from stoq.lib.options import get_option_parser parser = get_option_parser() group = optparse.OptionGroup(parser, 'Stoq') group.add_option('-A', '--autoreload', action="store_true", dest="autoreload", help='Autoreload application when source is modified') group.add_option('', '--quiet', action="store_true", dest="quiet", help='Be quiet about warnings') group.add_option('', '--fatal-warnings', action="store_false", dest="non_fatal_warnings", default=True, help='Make all warnings fatal') group.add_option('', '--login-username', action="store", dest="login_username", default=None, help='Username to login to stoq with') group.add_option('', '--no-splash-screen', action="store_false", dest="splashscreen", default=True, help='Disable the splash screen') group.add_option('', '--version', action="store_true", dest="version", help='Show the application version') group.add_option('', '--wizard', action="store_true", dest="wizard", default=None, help='Run the wizard') parser.add_option_group(group) options, args = parser.parse_args(args) if options.version: import stoq print(stoq.version) raise SystemExit() from stoq.gui.shell.bootstrap import boot_shell shell = boot_shell(options) return args, shell
def get_shell(args): log.info('parsing command line arguments: %s ' % (args, )) from stoq.lib.options import get_option_parser parser = get_option_parser() group = optparse.OptionGroup(parser, 'Stoq') group.add_option('', '--wizard', action="store_true", dest="wizard", default=None, help='Run the wizard') group.add_option('', '--login-username', action="store", dest="login_username", default=None, help='Username to login to stoq with') group.add_option('', '--no-splash-screen', action="store_false", dest="splashscreen", default=True, help='Disable the splash screen') group.add_option('', '--version', action="store_true", dest="version", help='Show the application version') parser.add_option_group(group) options, args = parser.parse_args(args) if options.version: import stoq raise SystemExit(stoq.version) from stoq.gui.shell.bootstrap import boot_shell shell = boot_shell(options) return args, shell