{"id":19606336,"url":"https://github.com/klen/pytest-redislite","last_synced_at":"2026-01-18T22:07:16.834Z","repository":{"id":42449832,"uuid":"405975378","full_name":"klen/pytest-redislite","owner":"klen","description":"Pytest plugin for testing code using Redi","archived":false,"fork":false,"pushed_at":"2022-04-05T14:20:12.000Z","size":20,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"develop","last_synced_at":"2025-03-14T16:15:41.768Z","etag":null,"topics":["pytest","redis","redislite"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/klen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-09-13T13:01:27.000Z","updated_at":"2024-11-28T16:35:03.000Z","dependencies_parsed_at":"2022-08-27T00:32:00.738Z","dependency_job_id":null,"html_url":"https://github.com/klen/pytest-redislite","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/klen%2Fpytest-redislite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/klen%2Fpytest-redislite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/klen%2Fpytest-redislite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/klen%2Fpytest-redislite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/klen","download_url":"https://codeload.github.com/klen/pytest-redislite/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247135123,"owners_count":20889420,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["pytest","redis","redislite"],"created_at":"2024-11-11T10:04:45.944Z","updated_at":"2026-01-18T22:07:11.804Z","avatar_url":"https://github.com/klen.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pytest-redislite\n\n**pytest-redislite** -- Is a simple [pytest](https://docs.pytest.org) plugin to\nhelp you test your projects using [Redis](https://redis.io).\n\n[![Tests Status](https://github.com/klen/pytest-redislite/workflows/tests/badge.svg)](https://github.com/klen/pytest-redislite/actions)\n[![PYPI Version](https://img.shields.io/pypi/v/pytest-redislite)](https://pypi.org/project/pytest-redislite)\n[![Python Versions](https://img.shields.io/pypi/pyversions/pytest-redislite)](https://pypi.org/project/pytest-redislite)\n\n## Features\n\n- Automatically starts/ends Redis for your tests using\n  [Redislite](https://github.com/yahoo/redislite)\n- Flash Redis Database between tests automatically\n\n## Requirements\n\n- python \u003e= 3.7\n\n## Installation\n\n**pytest-redislite** should be installed using pip:\n\n    pip install pytest-redislite\n\n## Usage\n\nWhen installed the plugin provides the fixture: `redis_url`\n\n```python\n\n    def test_code_with_redis(redis_url):\n        from redis import Redis\n\n        redis_client = Redis.from_url(redis_url)\n        redis_client.set('key', 'value')\n        assert redis_client.get('key', 'value')\n\n```\n\nWhen you are using the fixture Redis server will be started and finished after\nyour tests.\n\n## Configuration\n\nThe plugins support pytest command line options:\n\n- `--redis-path`: Specify a path to Redis Database file\n- `--redis-socket-path`: Specify a path to Redis Socket\n\nas well as pytest `ini` options:\n\n- `redis_path`: Specify a path to Redis Database file\n- `redis_socket_path`: Specify a path to Redis Socket\n\n\n## Fixtures\n\nThe plugin provides the fixtures:\n\n- `redis_server` (session scope) provides an instance of `redislite.Redis`. The\n  fixture manages the server's lifetime (start, shutdown).\n- `redis_url` (session scope) Starts redislite server and provides the server's\n  socket address.\n- `redis_factory` (session scope) a context manager to start/shutdown redislite\n  server.\n\n\n## Auto flush data between tests\n\nBy default the plugin erases all data in Redis between tests. If you would like\nto change the behaviour define the fixture:\n\n```python\n\n    @pytest.fixture\n    def redis_autoflash():\n        return False\n\n```\n\nYou may define it for a module or whole tests session.\n\n## Bug tracker\n\nIf you have any suggestions, bug reports or annoyances please report them to\nthe issue tracker at https://github.com/klen/pytest-redislite/issues\n\n\n## Contributing\n\nDevelopment of the project happens at: https://github.com/klen/pytest-redislite\n\n\n## License\n\nLicensed under a [MIT License](http://opensource.org/licenses/MIT)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fklen%2Fpytest-redislite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fklen%2Fpytest-redislite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fklen%2Fpytest-redislite/lists"}