Skip to content

[BUG-python/deployment] [CI] Fix argilla Integration Tests #54

Description

@JonnyTran

Describe the bug
The integration tests are failing due to issues with connecting to the argilla-server API from the argilla Python SDK

Stacktrace and Code to create the bug

 pdm run test tests/integration
============================= test session starts ==============================
platform linux -- Python 3.11.11, pytest-8.3.2, pluggy-1.5.0
rootdir: /home/runner/work/extralit/extralit/argilla
configfile: pyproject.toml
plugins: pytest_httpx-0.29.0, retry-1.6.3, typeguard-4.4.2, anyio-4.4.0, mock-3.14.0
collected 125 items

tests/integration/test_add_records.py EEEEEEEEEEEEEE                     [ 11%]
tests/integration/test_client.py EEE..                                   [ 15%]
tests/integration/test_create_datasets.py EEEEEEEE                       [ 21%]
tests/integration/test_dataset_workspace.py EEEEEEE                      [ 27%]
tests/integration/test_delete_records.py EEE                             [ 29%]
tests/integration/test_empty_settings.py EEE                             [ 32%]
tests/integration/test_export_dataset.py EEEEEEEEEEEEEEEEEEEE            [ 48%]
tests/integration/test_export_records.py EEEEEEEEEE                      [ 56%]
tests/integration/test_import_features.py EEEE                           [ 59%]
tests/integration/test_list_records.py EEEEEEEEEE                        [ 67%]
tests/integration/test_listing_datasets.py E                             [ 68%]
tests/integration/test_manage_metadata.py EEEEEEE                        [ 73%]
tests/integration/test_manage_users.py EEEE                              [ 76%]
tests/integration/test_manage_workspaces.py EEE                          [ 79%]
tests/integration/test_publish_datasets.py E                             [ 80%]
tests/integration/test_query_records.py EE                               [ 81%]
tests/integration/test_ranking_questions.py EE                           [ 83%]
tests/integration/test_search_records.py EEEEEEEEEE                      [ 91%]
tests/integration/test_update_dataset_settings.py EEEE                   [ 94%]
tests/integration/test_update_records.py EsEE                            [ 97%]
tests/integration/test_vectors.py EEE                                    [100%]

==================================== ERRORS ====================================
src/argilla/_exceptions/_api.py:91: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/argilla/_api/_workspaces.py:39: in create
    response.raise_for_status()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <Response [500 Internal Server Error]>

    def raise_for_status(self) -> "Response":
        """
        Raise the `HTTPStatusError` if one occurred.
        """
        request = self._request
        if request is None:
            raise RuntimeError(
                "Cannot call `raise_for_status` as the request "
                "instance has not been set on this response."
            )
    
        if self.is_success:
            return self
    
        if self.has_redirect_location:
            message = (
                "{error_type} '{0.status_code} {0.reason_phrase}' for url '{0.url}'\n"
                "Redirect location: '{0.headers[location]}'\n"
                "For more information check: [https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/{0.status_code}](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/%7B0.status_code%7D)"
            )
        else:
            message = (
                "{error_type} '{0.status_code} {0.reason_phrase}' for url '{0.url}'\n"
                "For more information check: [https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/{0.status_code}](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/%7B0.status_code%7D)"
            )
    
        status_class = self.status_code // 100
        error_types = {
            1: "Informational response",
            3: "Redirect response",
            4: "Client error",
            5: "Server error",
        }
        error_type = error_types.get(status_class, "Invalid status code")
        message = message.format(self, error_type=error_type)
>       raise HTTPStatusError(message, request=request, response=self)
E       httpx.HTTPStatusError: Server error '500 Internal Server Error' for url 'http://localhost:6900/api/v1/workspaces'
E       For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500

.venv/lib/python3.11/site-packages/httpx/_models.py:759: HTTPStatusError

During handling of the above exception, another exception occurred:

    @pytest.fixture(scope="session")
    def client() -> rg.Argilla:
        client = rg.Argilla()
    
        if len(list(client.workspaces)) == 0:
>           client.workspaces.add(rg.Workspace(name=f"test_{uuid.uuid4()}"))

See more at https://github.com/extralit/extralit/actions/runs/14438242814/job/40482947463#step:9:11764

Expected behavior

Passing integration tests to maintain code correctness.

Additional context

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No fields configured for Bug.

Projects

Status
2025 Q2 Apr - Jun

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions