Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests failing for python client from tag 1.1.31 #216

Closed
MementoRC opened this issue Jul 31, 2024 · 7 comments
Closed

Tests failing for python client from tag 1.1.31 #216

MementoRC opened this issue Jul 31, 2024 · 7 comments

Comments

@MementoRC
Copy link

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: conda-forge/staged-recipes#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

Copy link

linear bot commented Jul 31, 2024

@samtin0x
Copy link
Contributor

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:

  • Poetry Entry Point:
    Modify the conda-forge recipe to use Poetry as the entry point for running tests, similar to the setup I used. This involves adjusting the test command in the recipe to use poetry run pytest instead of running pytest directly.
  • Add Missing Requirements:
    Update the recipe to include the dependencies that were present in the successful local setup. Specifically, add pytest-asyncio and pytest-dotenv to the test requirements section of the recipe:
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
Copy link
Author

MementoRC commented Aug 12, 2024

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
Copy link
Contributor

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
Copy link
Contributor

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

@MementoRC
Copy link
Author

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

@MementoRC
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants