{"id":24998979,"url":"https://github.com/tomasfarias/pytest-keyring","last_synced_at":"2026-04-10T14:03:26.926Z","repository":{"id":194669746,"uuid":"691325831","full_name":"tomasfarias/pytest-keyring","owner":"tomasfarias","description":"Pytest plugin to access any configured keyring using the keyring package.","archived":false,"fork":false,"pushed_at":"2024-12-08T18:09:08.000Z","size":60,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-25T10:48:16.251Z","etag":null,"topics":["pytest","pytest-plugin"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tomasfarias.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-09-14T00:38:16.000Z","updated_at":"2024-12-08T18:04:29.000Z","dependencies_parsed_at":null,"dependency_job_id":"3e3dcba3-3717-4ce5-970e-cd004f39c3e5","html_url":"https://github.com/tomasfarias/pytest-keyring","commit_stats":null,"previous_names":["tomasfarias/pytest-keyring"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/tomasfarias/pytest-keyring","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomasfarias%2Fpytest-keyring","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomasfarias%2Fpytest-keyring/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomasfarias%2Fpytest-keyring/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomasfarias%2Fpytest-keyring/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tomasfarias","download_url":"https://codeload.github.com/tomasfarias/pytest-keyring/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomasfarias%2Fpytest-keyring/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28868877,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-29T06:56:44.678Z","status":"ssl_error","status_checked_at":"2026-01-29T06:56:35.794Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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","pytest-plugin"],"created_at":"2025-02-04T18:52:39.717Z","updated_at":"2026-04-10T14:03:26.919Z","avatar_url":"https://github.com/tomasfarias.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pytest-keyring\n\n[![PyPI](https://img.shields.io/pypi/v/pytest-keyring?style=flat-square)](https://pypi.org/project/pytest-keyring)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pytest-keyring?style=flat-square)](https://pypi.org/project/pytest-keyring)\n[![PyPI - License](https://img.shields.io/pypi/l/pytest-keyring?style=flat-square)](https://opensource.org/licenses/MIT)\n\nPytest plugin to access any configured keyring using the [`keyring`](https://pypi.org/project/keyring/) package.\n\n## Motivation\n\nFrequently, tests require access to services, like databases, REST APIs, or blob storages. These services are sometimes hard or impossible to mock or reproduce in a test environment. In particular, functional or end-to-end tests will be inclined to interact with real instances of these services. Accessing these services can require credentials, and using the keyring can be an alternative to populating CI environment variables with credentials.\n\n## Installation\n\nInstall with:\n\n```bash\npython -m pip install pytest-keyring\n```\n\nAny python version newer than 3.8 is supported.\n\n## Usage\n\n### Accessing credentials in keyring\n\nAny test arguments whose names match the prefixes configured by `--keyring-password-prefix` and `--keyring-credential-prefix` (`\"password\"` and `\"credential\"` by default) will be replaced by the corresponding password or credential, respectively:\n\n```python\ndef test_with_database(credential_postgres_dbuser):\n    client = connect(\n        username=credential_postgres_dbuser.username,\n        password=credential_postgres_dbuser.password\n    )\n    ...\n```\n\nWhen collecting the test, the `credential_postgres_dbuser` instructs `pytest-keyring` to fetch the credential for the \"postgres\" service and the \"dbuser\" username, by making the following call to `keyring.get_credential`:\n\n```python\nkeyring.get_credential(\"postgres\", \"dbuser\")\n```\n\n### Configuring a keyring backend\n\nThe `--keyring-backend` configuration flag can be used to specify a keyring backend. For example, setting the null keyring backend:\n\n```bash\npytest --keyring-backend=keyring.backends.null.Keyring\n```\n\nCauses all credentials and passwords to be `None`:\n\n```python\ndef test_with_null_backend(credential_postgres_dbuser, password_postgres_dbuser):\n    assert credential_postgres_dbuser is None\n    assert password_postgres_dbuser is None\n    ...\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomasfarias%2Fpytest-keyring","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftomasfarias%2Fpytest-keyring","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomasfarias%2Fpytest-keyring/lists"}