{"id":24530,"library":"rltest","title":"RLTest - Redis Modules Test Framework","description":"RLTest is a test framework for Redis modules, allowing developers to run tests on Redis and modules across various environments (containers, local, cloud). The current version is 0.7.25, with maintenance mode status. It is a core tool in the Redis module ecosystem, receiving occasional updates.","status":"maintenance","version":"0.7.25","language":"python","source_language":"en","source_url":"https://github.com/RedisGears/RLTest","tags":["redis","testing","modules","integration-tests"],"install":[{"cmd":"pip install rltest","lang":"bash","label":"pip install rltest"}],"dependencies":[{"reason":"RLTest uses redis-py to interact with Redis instances for testing.","package":"redis-py","optional":false}],"imports":[{"note":"The main class is RLTest, not RLTestCase (which exists but is less commonly used).","wrong":"from rltest import RLTestCase","symbol":"RLTest","correct":"from rltest import RLTest"},{"note":"TestEnvironment is in the submodule rltest.env, not directly under rltest.","wrong":"from rltest import TestEnvironment","symbol":"TestEnvironment","correct":"from rltest.env import TestEnvironment"}],"quickstart":{"code":"from rltest import RLTest, TestEnvConfig\n\n# Create environment configuration\nenv_config = TestEnvConfig(\n    module_path='/path/to/your/module.so',\n    redis_port=6379\n)\n\n# Create test instance\nrt = RLTest(env_config)\n\n# Define your test method\ndef test_my_module():\n    client = rt.env.get_redis_connection()\n    assert client.ping()\n\n# Run tests\nif __name__ == '__main__':\n    rt.run()","lang":"python","description":"Minimal RLTest usage: configure module path, create environment, define tests, run."},"warnings":[{"fix":"Consider using pytest integration: pip install pytest-rltest and write test functions with pytest fixtures.","message":"RLTest now recommends using pytest-based approach (pytest-rltest) instead of traditional RLTest classes. The standalone RLTest class may be deprecated in future releases.","severity":"deprecated","affected_versions":">=0.7.0"},{"fix":"Explicitly set module_path, binary_path, or use a pre-existing Redis instance via connection_params.","message":"Missing 'module_path' or 'binary_path' in TestEnvConfig will cause the environment to fail silently or use default Redis (without module). Always set at least one.","severity":"gotcha","affected_versions":"all"},{"fix":"Use TestEnvConfig from rltest.config (though often imported directly from rltest).","message":"EnvConfig (deprecated) vs TestEnvConfig: Older code uses EnvConfig, but it's deprecated. Using EnvConfig may break in newer versions.","severity":"gotcha","affected_versions":">=0.6.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run: pip install rltest","cause":"rltest package not installed.","error":"ModuleNotFoundError: No module named 'rltest'"},{"fix":"Update to new pattern: define a function and call RLTestEnv.run_tests() or use pytest.","cause":"Using old pattern where RLTest.run() is not available; need to use the function-based style.","error":"AttributeError: 'RLTest' object has no attribute 'run'"},{"fix":"Install a local Redis or set TestEnvConfig(redis_binary='/usr/bin/redis-server') to start an embedded server.","cause":"Default Redis server is not running; RLTest can't spin up an instance if 'redis_binary' not configured.","error":"redis.exceptions.ConnectionError: Error 111 connecting to localhost:6379. Connection refused."}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}