Beispiel #1
0
    def test_get_usage(self):

        manager = Manager(self.app)
        manager.add_command('simple', SimpleCommand())

        usage = manager.create_parser('manage.py').format_help()
        assert 'simple command' in usage
Beispiel #2
0
    def test_get_usage(self):

        manager = Manager(self.app)
        manager.add_command('simple', SimpleCommand())

        usage = manager.create_parser('manage.py').format_help()
        assert 'simple command' in usage
Beispiel #3
0
    def test_get_usage_with_specified_usage(self):

        manager = Manager(self.app, usage='hello')
        manager.add_command('simple', SimpleCommand())

        usage = manager.create_parser('manage.py').format_help()
        assert 'simple command' in usage
        assert 'hello' in usage
Beispiel #4
0
    def test_get_usage_with_specified_usage(self):

        manager = Manager(self.app, usage='hello')
        manager.add_command('simple', SimpleCommand())

        usage = manager.create_parser('manage.py').format_help()
        assert 'simple command' in usage
        assert 'hello' in usage
Beispiel #5
0
            para += '-k %s ' % keyword

    from colorama import init, Fore
    init(autoreset=True)

    cmd = 'pybabel extract -F babel.cfg %s -o %s/translations/messages.pot %s' % \
          (para, app4name, app4name)
    print(Fore.RED + 'Running: %s' % cmd)
    os.system(cmd)

    cmd = 'pybabel update -i %s/translations/messages.pot -d %s/translations' % \
          (app4name, app4name)
    print(Fore.RED + 'Running: %s' % cmd)
    os.system(cmd)


if __name__ == "__main__":
    log_config = 'instance/logging.yaml'
    logging.config.dictConfig(yaml.load(open(log_config, 'r')))

    app_namespace, _ = manager.create_parser(sys.argv[0]).parse_known_args(sys.argv[1:])
    kwargs = app_namespace.__dict__
    if 'app_name' in kwargs:
        try:
            running_jobs = importlib.import_module(kwargs['app_name'] + '.jobs')
            running_jobs.configure_jobs()
        except (ImportError, AttributeError):
            pass

    manager.run()