Compatibility-breaking starlette 0.21 -> failing test_delete_token #16

Closed
opened 2022-10-15 16:54:02 +03:00 by houkime · 9 comments
Collaborator

On master branch, 0a09a338b8
When running pytest

test_rest_endpoints/test_auth.py::test_delete_token - TypeError: TestClient.delete() got an unexpected keyword argument 'json'
On master branch, 0a09a338b850704f221bd9b451519290584ef209 When running pytest ``` test_rest_endpoints/test_auth.py::test_delete_token - TypeError: TestClient.delete() got an unexpected keyword argument 'json' ```
Poster
Collaborator
FAILED test_rest_endpoints/test_auth.py::test_delete_token - TypeError: TestClient.delete() got an unexpected keyword argument 'json'
FAILED test_rest_endpoints/test_auth.py::test_delete_self_token - TypeError: TestClient.delete() got an unexpected keyword argument 'json'
FAILED test_rest_endpoints/test_auth.py::test_delete_nonexistent_token - TypeError: TestClient.delete() got an unexpected keyword argument 'json'
FAILED test_rest_endpoints/test_auth.py::test_get_and_delete_new_device_token - TypeError: TestClient.delete() got an unexpected keyword argument 'json'
FAILED test_rest_endpoints/services/test_ssh.py::test_delete_root_key - TypeError: TestClient.delete() got an unexpected keyword argument 'json'
FAILED test_rest_endpoints/services/test_ssh.py::test_delete_root_nonexistent_key - TypeError: TestClient.delete() got an unexpected keyword argument 'json'
FAILED test_rest_endpoints/services/test_ssh.py::test_delete_root_key_on_undefined - TypeError: TestClient.delete() got an unexpected keyword argument 'json'
FAILED test_rest_endpoints/services/test_ssh.py::test_delete_admin_key - TypeError: TestClient.delete() got an unexpected keyword argument 'json'
FAILED test_rest_endpoints/services/test_ssh.py::test_delete_nonexistent_admin_key - TypeError: TestClient.delete() got an unexpected keyword argument 'json'
FAILED test_rest_endpoints/services/test_ssh.py::test_delete_admin_key_on_undefined - TypeError: TestClient.delete() got an unexpected keyword argument 'json'
FAILED test_rest_endpoints/services/test_ssh.py::test_delete_user_key - TypeError: TestClient.delete() got an unexpected keyword argument 'json'
FAILED test_rest_endpoints/services/test_ssh.py::test_delete_nonexistent_user_key[2] - TypeError: TestClient.delete() got an unexpected keyword argument 'json'
FAILED test_rest_endpoints/services/test_ssh.py::test_delete_nonexistent_user_key[3] - TypeError: TestClient.delete() got an unexpected keyword argument 'json'
FAILED test_rest_endpoints/services/test_ssh.py::test_delete_keys_of_nonexistent_user - TypeError: TestClient.delete() got an unexpected keyword argument 'json'
FAILED test_rest_endpoints/services/test_ssh.py::test_delete_key_when_undefined_users - TypeError: TestClient.delete() got an unexpected keyword argument 'json'
``` FAILED test_rest_endpoints/test_auth.py::test_delete_token - TypeError: TestClient.delete() got an unexpected keyword argument 'json' FAILED test_rest_endpoints/test_auth.py::test_delete_self_token - TypeError: TestClient.delete() got an unexpected keyword argument 'json' FAILED test_rest_endpoints/test_auth.py::test_delete_nonexistent_token - TypeError: TestClient.delete() got an unexpected keyword argument 'json' FAILED test_rest_endpoints/test_auth.py::test_get_and_delete_new_device_token - TypeError: TestClient.delete() got an unexpected keyword argument 'json' FAILED test_rest_endpoints/services/test_ssh.py::test_delete_root_key - TypeError: TestClient.delete() got an unexpected keyword argument 'json' FAILED test_rest_endpoints/services/test_ssh.py::test_delete_root_nonexistent_key - TypeError: TestClient.delete() got an unexpected keyword argument 'json' FAILED test_rest_endpoints/services/test_ssh.py::test_delete_root_key_on_undefined - TypeError: TestClient.delete() got an unexpected keyword argument 'json' FAILED test_rest_endpoints/services/test_ssh.py::test_delete_admin_key - TypeError: TestClient.delete() got an unexpected keyword argument 'json' FAILED test_rest_endpoints/services/test_ssh.py::test_delete_nonexistent_admin_key - TypeError: TestClient.delete() got an unexpected keyword argument 'json' FAILED test_rest_endpoints/services/test_ssh.py::test_delete_admin_key_on_undefined - TypeError: TestClient.delete() got an unexpected keyword argument 'json' FAILED test_rest_endpoints/services/test_ssh.py::test_delete_user_key - TypeError: TestClient.delete() got an unexpected keyword argument 'json' FAILED test_rest_endpoints/services/test_ssh.py::test_delete_nonexistent_user_key[2] - TypeError: TestClient.delete() got an unexpected keyword argument 'json' FAILED test_rest_endpoints/services/test_ssh.py::test_delete_nonexistent_user_key[3] - TypeError: TestClient.delete() got an unexpected keyword argument 'json' FAILED test_rest_endpoints/services/test_ssh.py::test_delete_keys_of_nonexistent_user - TypeError: TestClient.delete() got an unexpected keyword argument 'json' FAILED test_rest_endpoints/services/test_ssh.py::test_delete_key_when_undefined_users - TypeError: TestClient.delete() got an unexpected keyword argument 'json' ```
Poster
Collaborator

the offending lines

    response = authorized_client.delete(
        "/auth/tokens", json={"token_name": "test_token2"}
    )
the offending lines ``` response = authorized_client.delete( "/auth/tokens", json={"token_name": "test_token2"} ) ```
Poster
Collaborator

definition of the test client is in starlette package

    def delete(  # type: ignore[override]
        self,
        url: httpx._types.URLTypes,
        *,
        params: httpx._types.QueryParamTypes = None,
        headers: httpx._types.HeaderTypes = None,
        cookies: httpx._types.CookieTypes = None,
        auth: typing.Union[
            httpx._types.AuthTypes, httpx._client.UseClientDefault
        ] = httpx._client.USE_CLIENT_DEFAULT,
        follow_redirects: bool = None,
        allow_redirects: bool = None,
        timeout: typing.Union[
            httpx._client.TimeoutTypes, httpx._client.UseClientDefault
        ] = httpx._client.USE_CLIENT_DEFAULT,
        extensions: dict = None,
    ) -> httpx.Response:
        redirect = self._choose_redirect_arg(follow_redirects, allow_redirects)
        return super().delete(
            url,
            params=params,
            headers=headers,
            cookies=cookies,
            auth=auth,
            follow_redirects=redirect,
            timeout=timeout,
            extensions=extensions,
        )
definition of the test client is in `starlette` package ```python def delete( # type: ignore[override] self, url: httpx._types.URLTypes, *, params: httpx._types.QueryParamTypes = None, headers: httpx._types.HeaderTypes = None, cookies: httpx._types.CookieTypes = None, auth: typing.Union[ httpx._types.AuthTypes, httpx._client.UseClientDefault ] = httpx._client.USE_CLIENT_DEFAULT, follow_redirects: bool = None, allow_redirects: bool = None, timeout: typing.Union[ httpx._client.TimeoutTypes, httpx._client.UseClientDefault ] = httpx._client.USE_CLIENT_DEFAULT, extensions: dict = None, ) -> httpx.Response: redirect = self._choose_redirect_arg(follow_redirects, allow_redirects) return super().delete( url, params=params, headers=headers, cookies=cookies, auth=auth, follow_redirects=redirect, timeout=timeout, extensions=extensions, ) ```
Poster
Collaborator

0.21.0 of starlette has landed 19 days ago and was a compatibility breaking release.
they provide a migration tool to make un-breaking the tests easier.
https://github.com/encode/starlette/releases/tag/0.21.0

0.21.0 of starlette has landed 19 days ago and was a compatibility breaking release. they provide a migration tool to make un-breaking the tests easier. https://github.com/encode/starlette/releases/tag/0.21.0
houkime changed title from Failing test_delete_token to Compatibility-breaking starlette 0.21 -> failing test_delete_token 2022-10-15 17:24:12 +03:00
def self-assigned this 2022-10-15 18:52:31 +03:00
inex was assigned by def 2022-10-15 18:52:44 +03:00
Poster
Collaborator

The unbreaking tool works, so migrating tests is not the problem.
However, one needs to sync this change of tests with bumping statlette in nix.
Bumping starlette will require bumping python because there are no newer typing-extensions for python 3.9

The unbreaking tool works, so migrating tests is not the problem. However, one needs to sync this change of tests with bumping statlette in nix. Bumping starlette will require bumping python because there are no newer typing-extensions for python 3.9
Poster
Collaborator

bumping python to 3.10 passes this obstacle but is blocked by anyio

No matching distribution found for anyio<5,>=3.4.0
bumping python to 3.10 passes this obstacle but is blocked by anyio ``` No matching distribution found for anyio<5,>=3.4.0 ```

0.21 version didn't land to NixOS yet. Error didn't show up on nixpkgs-unstable branch.

Starlette upgrade is pending on https://github.com/NixOS/nixpkgs/pull/193923

I guess we have to wait right now.

0.21 version didn't land to NixOS yet. Error didn't show up on nixpkgs-unstable branch. Starlette upgrade is pending on https://github.com/NixOS/nixpkgs/pull/193923 I guess we have to wait right now.
Poster
Collaborator

starlette is now 0.26 in 23.05 release of nix-pkgs
4ecab32735/pkgs/development/python-modules/starlette

starlette is now 0.26 in 23.05 release of nix-pkgs https://github.com/NixOS/nixpkgs/tree/4ecab3273592f27479a583fb6d975d4aba3486fe/pkgs/development/python-modules/starlette
NaiJi added the
Bug
label 2023-07-12 17:56:00 +03:00
Poster
Collaborator

Starlette is now 0.31 and we use it this way.

Starlette is now 0.31 and we use it this way.
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: SelfPrivacy/selfprivacy-rest-api#16
There is no content yet.