Skip to content

task: It's not possible to run SDK unittests when you have environment variables that set credentials #38

@ogenstad

Description

@ogenstad

Component

Python SDK, CI/CD

Task Description

❯ printenv | grep SDK
INFRAHUB_SDK_PASSWORD=infrahub
INFRAHUB_SDK_USERNAME=admin

Having this in your environment makes the unittests fail:

>       raise httpx.TimeoutException(
            self._explain_that_no_response_was_found(request), request=request
        )
E       httpx.TimeoutException: No response can be found for POST request on http://mock/api/auth/login amongst:
E       Match GET requests on http://mock/api/schema/?branch=main

../../../.virtualenvs/infrahub/lib/python3.10/site-packages/pytest_httpx/_httpx_mock.py:192: TimeoutException
=============================================================================================================================== short test summary info ================================================================================================================================
FAILED python_sdk/tests/unit/test_branch.py::test_get_branches[standard] - httpx.TimeoutException: No response can be found for POST request on http://mock/api/auth/login with {} headers amongst:
FAILED python_sdk/tests/unit/test_branch.py::test_get_branches[sync] - httpx.TimeoutException: No response can be found for POST request on http://mock/api/auth/login with {} headers amongst:
FAILED python_sdk/tests/unit/test_client.py::test_get_repositories - httpx.TimeoutException: No response can be found for POST request on http://mock/api/auth/login with {} headers amongst:
FAILED python_sdk/tests/unit/test_client.py::test_method_all_with_limit[standard] - httpx.TimeoutException: No response can be found for POST request on http://mock/api/auth/login with {} headers amongst:
FAILED python_sdk/tests/unit/test_client.py::test_method_all_with_limit[sync] - httpx.TimeoutException: No response can be found for POST request on http://mock/api/auth/login with {} headers amongst:
FAILED python_sdk/tests/unit/test_client.py::test_method_all_multiple_pages[standard] - httpx.TimeoutException: No response can be found for POST request on http://mock/api/auth/login with {} headers among

This is a bit annoying, we should override these credentials in the test setups.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions