diff --git a/pkgs/development/python-modules/python-keycloak/default.nix b/pkgs/development/python-modules/python-keycloak/default.nix index 0ac6c2b31550..5d831b6951d8 100644 --- a/pkgs/development/python-modules/python-keycloak/default.nix +++ b/pkgs/development/python-modules/python-keycloak/default.nix @@ -9,24 +9,27 @@ poetry-core, requests, requests-toolbelt, + freezegun, + pytest-asyncio, + pytestCheckHook, }: -buildPythonPackage rec { +buildPythonPackage (finalAttrs: { pname = "python-keycloak"; - version = "7.0.2"; + version = "7.1.1"; pyproject = true; src = fetchFromGitHub { owner = "marcospereirampj"; repo = "python-keycloak"; - tag = "v${version}"; - hash = "sha256-3JHmVfGd5X5aEZt8O7Aj/UfYpLtDsI6MPwWxLo7SGBs="; + tag = "v${finalAttrs.version}"; + hash = "sha256-3BrXSktN0OYQJRRZ234z06pGHicJOIBUzSdMd6y95L4="; }; postPatch = '' # Upstream doesn't set version substituteInPlace pyproject.toml \ - --replace-fail 'version = "0.0.0"' 'version = "${version}"' + --replace-fail 'version = "0.0.0"' 'version = "${finalAttrs.version}"' ''; build-system = [ poetry-core ]; @@ -40,16 +43,34 @@ buildPythonPackage rec { requests-toolbelt ]; - # Test fixtures require a running keycloak instance - doCheck = false; + nativeCheckInputs = [ + freezegun + pytest-asyncio + pytestCheckHook + ]; + + # conftest.py requires these variables to be set, + # even if the respective tests are disabled + preCheck = '' + export KEYCLOAK_{HOST,PORT,ADMIN{,_PASSWORD}}= + ''; + + disabledTestPaths = [ + # these tests require a running keycloak instance + "tests/test_keycloak_openid.py" + "tests/test_keycloak_admin.py" + "tests/test_keycloak_uma.py" + # requires docker + "tests/test_pkce_flow.py" + ]; pythonImportsCheck = [ "keycloak" ]; meta = { description = "Provides access to the Keycloak API"; homepage = "https://github.com/marcospereirampj/python-keycloak"; - changelog = "https://github.com/marcospereirampj/python-keycloak/blob/${src.tag}/CHANGELOG.md"; + changelog = "https://github.com/marcospereirampj/python-keycloak/blob/${finalAttrs.src.rev}/CHANGELOG.md"; license = lib.licenses.mit; maintainers = [ ]; }; -} +})