k5test
A library for testing Python applications in self-contained Kerberos 5 environments
What it is and what it does
k5test is a testing library that automates the setup and teardown of isolated Kerberos 5 environments for Python unit tests. Instead of manually configuring Kerberos realms or relying on system-wide Kerberos configuration, developers inherit from KerberosTestCase and get a self-contained test realm automatically provisioned before each test and cleaned up afterwards. This isolation is valuable for testing Kerberos-dependent applications without affecting production or shared Kerberos infrastructure.
The library also provides decorators to conditionally skip tests based on Kerberos version, GSSAPI extension availability, or installed plugins. It supports both MIT krb5 and Heimdal implementations and has been maintained since 2015, with support for Python 3.6 through 3.11. No runtime dependencies are required for basic use, though optional integration with python-gssapi enables extension-aware test skipping.
Use it for:
- Test Kerberos authentication flows in isolation without modifying system Kerberos configuration.
- Run GSSAPI-dependent unit tests with automatic environment setup and teardown per test case.
- Skip tests conditionally when krb5 version is below a required minimum or when specific GSSAPI extensions are unavailable.
- Validate Kerberos realm configuration and credential handling in a sandboxed environment.
- Test applications that depend on Kerberos plugins without requiring those plugins in the test environment.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
k5test sets up isolated Kerberos 5 test environments and provides test case classes and decorators to run Python unit tests within those environments without affecting system Kerberos configuration.
Yes, if you are testing Kerberos or GSSAPI-dependent Python applications. The library eliminates manual Kerberos setup boilerplate and provides clean test isolation. However, note that maintenance is dormant (last release 877 days ago); if you need active support or compatibility with very recent Kerberos versions, evaluate whether the package still meets your requirements. For stable, long-term Kerberos testing needs, it remains a solid choice.
Install
k5test on PyPI
pip
pip install k5testuv
uv add k5testpoetry
poetry add k5testInstalling k5test
Before you install
Low install friction with no runtime dependencies. Maintenance is dormant—last release was 877 days ago, though the repository remains active with a recent commit on 2024-11-11. Suitable for projects with stable Kerberos testing needs but not for active feature development.
License in practice
Dual-licensed under ISC and MIT, both permissive licenses. You can use, modify, and distribute the package freely with minimal restrictions.
Quickstart
pip install k5test
from k5test import KerberosTestCase
class MyKerberosTest(KerberosTestCase):
def test_kerberos_operation(self):
# Kerberos 5 environment is automatically set up
pass
Requires MIT Kerberos 5 (krb5) or Heimdal to be installed on the system; k5test does not bundle Kerberos itself.
Verify before relying
- Whether the dormant maintenance status (877 days since last release) affects compatibility with recent Kerberos versions or Python 3.10+.
- Specific version requirements or known incompatibilities with particular krb5 or Heimdal releases.
- Whether optional dependencies like python-gssapi are required for core functionality or only for decorator features.
Package facts
| License | not declared (permissive) |
| Python support | supports the current Python release (>=3.6) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | dormant — 877 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 164,543/month — #10,544 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: k5test-0.10.4-py2.py3-none-any.whl
Keywords: gssapi, security
Tags
More Security packages
Provides Python bindings to the FreeDesktop.org…
permissive · top 1,000 on PyPI
msalMSAL for Python handles OAuth2 and OpenID…
permissive · top 1,000 on PyPI
joserfcjoserfc implements JOSE standards (JWS, JWE,…
permissive · top 1,000 on PyPI
AuthlibAuthlib provides a complete implementation of…
permissive · top 1,000 on PyPI
argon2-cffi-bindingsProvides low-level CFFI bindings to the…
permissive · top 1,000 on PyPI
adalADAL for Python authenticates applications with…
permissive · top 1,000 on PyPI
krb5Wraps the Kerberos 5 C API to provide Python…
permissive · top 5,000 on PyPI
python-kadmin-rsPython bindings for Kerberos administration…
permissive · top 15,000 on PyPI
kerberosProvides a high-level Python wrapper for…
permissive · top 5,000 on PyPI
pykerberosProvides a Python wrapper for Kerberos (GSSAPI)…
permissive · top 5,000 on PyPI
requests-gssapiAdds GSSAPI/Kerberos authentication support to…
permissive · top 15,000 on PyPI
gssapiPython-GSSAPI wraps the GSSAPI C libraries to…
permissive · top 5,000 on PyPI
requests-kerberosAdds Kerberos/GSSAPI authentication support to…
permissive · top 5,000 on PyPI
winkerberosProvides native Kerberos client authentication…
permissive · top 5,000 on PyPI
pyspnegoHandles SPNEGO, NTLM, Kerberos, and CredSSP…
permissive · top 1,000 on PyPI
requests-credsspAdds CredSSP authentication support to the…
permissive · top 15,000 on PyPI