def runtests(options): os.environ['DJANGO_SETTINGS_MODULE'] = options.settings redis_version = options.redis_version is_sockets_test = options.settings == "tests.sockets_settings" conf = load_settings(options.settings) if conf is None: sys.stderr.write('Cannot load settings module: %s\n' % options.settings) return sys.exit(1) # If server path was not specified, then assume an instance of redis with # default configuration is running if options.server_path is None: failures = _runtests('127.0.0.1', 6379, settings.CACHES['default']['OPTIONS']['PASSWORD']) else: redis_conf_path = options.conf or join(dirname(__file__), 'tests', 'redis.conf') server.configure(options.server_path, redis_conf_path, 0) try: print join(dirname(__file__), 'tests' ,'redis.conf.%s' % redis_version) redis_conf_template = open(join(dirname(__file__), 'tests' ,'redis.conf.%s' % redis_version)).read() except OSError, IOError: sys.stderr.write('Cannot find template for redis.conf.\n') context = Context({ 'redis_socket': join(dirname(abspath(__file__)), 'tests', 'redis.sock') }) contents = Template(redis_conf_template).render(context) with TmpFile(redis_conf_path, contents): if not is_sockets_test: conf['CACHES']['default']['LOCATION'] = "%s:%s" % (server.host, server.port) reset_settings() settings.configure(**conf) with server: failures = _runtests(server.host, server.port, server.password)
def runtests(options): os.environ['DJANGO_SETTINGS_MODULE'] = options.settings redis_conf_path = options.conf or join(dirname(__file__), 'tests', 'redis.conf') server.configure(options.server_path, redis_conf_path, 0) conf = load_settings(options.settings) if conf is None: sys.stderr.write('Cannot load settings module: %s\n' % options.settings) return sys.exit(1) try: redis_conf_template = open(join(dirname(__file__), 'tests' ,'redis.conf.tpl')).read() except OSError, IOError: sys.stderr.write('Cannot find template for redis.conf.\n')
def runtests(options): os.environ['DJANGO_SETTINGS_MODULE'] = options.settings redis_version = options.redis_version is_sockets_test = options.settings == "tests.sockets_settings" conf = load_settings(options.settings) if conf is None: sys.stderr.write('Cannot load settings module: %s\n' % options.settings) return sys.exit(1) # If server path was not specified, then assume an instance of redis with # default configuration is running if options.server_path is None: failures = _runtests('127.0.0.1', 6379, settings.CACHES['default']['OPTIONS']['PASSWORD']) else: redis_conf_path = options.conf or join(dirname(__file__), 'tests', 'redis.conf') server.configure(options.server_path, redis_conf_path, 0) try: print join(dirname(__file__), 'tests', 'redis.conf.%s' % redis_version) redis_conf_template = open( join(dirname(__file__), 'tests', 'redis.conf.%s' % redis_version)).read() except OSError, IOError: sys.stderr.write('Cannot find template for redis.conf.\n') context = Context({ 'redis_socket': join(dirname(abspath(__file__)), 'tests', 'redis.sock') }) contents = Template(redis_conf_template).render(context) with TmpFile(redis_conf_path, contents): if not is_sockets_test: conf['CACHES']['default']['LOCATION'] = "%s:%s" % (server.host, server.port) reset_settings() settings.configure(**conf) with server: failures = _runtests(server.host, server.port, server.password)