dydxprotocol / v4-clients

Other
78 stars 57 forks source link

Tests failing for python client from tag 1.1.31 #216

Closed MementoRC closed 3 months ago

MementoRC commented 3 months ago

We are trying to integrate dydx_v4_client within the conda-forge environment. We have put together a recipe to build from the tag 1.1.31 at: https://github.com/conda-forge/staged-recipes/pull/27129

Currently, this recipe has some of its tests failing:

+ poetry run pytest
============================= test session starts ==============================
platform linux -- Python 3.12.4, pytest-8.3.2, pluggy-1.5.0
rootdir: $SRC_DIR/v4-client-py-v2
configfile: pyproject.toml
plugins: anyio-4.4.0, asyncio-0.23.8, dotenv-0.5.2
asyncio: mode=Mode.STRICT
collected 64 items

tests/indexer/rest/modules/test_account_endpoints.py ..........          [ 15%]
tests/indexer/rest/modules/test_markets_endpoints.py .......             [ 26%]
tests/indexer/rest/modules/test_status_endpoints.py ..s                  [ 31%]
tests/indexer/rest/test_noble_client.py Fsss                             [ 37%]
tests/indexer/socket/test_websocket.py FFFFF                             [ 45%]
tests/test_faucet_client.py FF                                           [ 48%]
tests/test_mutating_node_client.py FFFFF                                 [ 56%]
tests/test_query_node_client.py FFFFFFFFFFFFFFFFFFFFFF                   [ 90%]
tests/test_v4_proto.py ......                                            [100%]

=================================== FAILURES ===================================
______________________________ test_is_connected _______________________________

noble_client = <async_generator object noble_client at 0x7f50bc45e980>

    @pytest.mark.asyncio
    async def test_is_connected(noble_client):
>       assert noble_client.is_connected
E       AttributeError: 'async_generator' object has no attribute 'is_connected'

From the workflow and the doc (I may I missed something) I did not see what I might be doing wrongly Thx

linear[bot] commented 3 months ago

GH-59 Tests failing for python client from tag 1.1.31

samtin0x commented 3 months ago

Hi @MementoRC ,

I ran the following commands and all tests passed successfully on my end.

pip install dydx-v4-client pytest pytest-asyncio python-dotenv
git clone https://github.com/dydxprotocol/v4-clients.git
cd v4-clients/v4-client-py-v2
pytest tests/

The issue seems to be related to the Async Test Configuration in the conda-forge environment. Here are two options to address this:

test:
  requires:
    - pip
    - poetry
    - pytest
    - pytest-asyncio # ADD THIS
    - pytest-dotenv  # ADD THIS

This will ensures the conda-forge env has all the necessary packages to handle the async tests. Option 2 might be simpler to implement and could resolve the issue without altering how tests are run in the recipe.

Let me know!

MementoRC commented 3 months ago

Thanks. I actually have both in the recipe: plugins: anyio-4.4.0, asyncio-0.23.8, dotenv-0.5.2 Could it be due to using v4-proto v5.0.6? I only created a recipe for that version, so I patch the pyproject.toml. Once the recipes are pushed into feedstock, I can look into back-populating older versions. So this is not a major issue, running the tests is not a requirement for conda-forge, but since I am fairly novice, I like to do it. For now, I can simply document them

Note that I am also working on the JS and CPP libraries. I do have a few difficulties there as well.

Lastly, is there anyone interested in becoming co-maintainer? it would help to synchronize the future updates. I still plan to do most of the work.

samtin0x commented 3 months ago

Hi @MementoRC it's possible that's the issue, let me bump v4-proto version - with regards your other comments, I'll ask the team

samtin0x commented 3 months ago

Once PR 223 is merged, v4-proto should be v5.2.1

MementoRC commented 3 months ago

Thank you for the update. I will await the tag 1.1.32 and update the recipe

MementoRC commented 2 months ago

FYI, the python client package is live on conda-forge: https://github.com/conda-forge/dydx-v4-client-split-feedstock

Let me know (or submit a bot command: https://github.com/conda-forge/dydx-v4-client-split-feedstock/issues/new?assignees=&labels=&projects=&template=2-bot-commands.yml with@conda-forge-admin, please add user @xxx) Thx