bitfinexcom/bitfinex-api-py

pytests failing under pytest-asyncio 0.10.0

Closed this issue · 3 comments

Issue type

  • bug

Brief description

After installing requirements with:

pip install -r requirements.txt

I ran the pytests, and got this error:

"direct construction of function has been deprecated please use functiaon.from_parent"

I upgraded pytest-asyncio to 0.14.0 and the tests passed.

Steps to reproduce

Additional Notes:

My Python version us 3.8.5

Hey @jsphon !

Could you try the following installation, and check if it works that way?

python3 -m pip install bitfinex-api-py

Cheers!

I tried that, and it didn't make a difference. But perhaps I am doing it wrong.

Once I have installed bitfinex-api-py using pip, how should I run the tests?

At the moment, I am running by just running pytest from the project's folder. However, in this situation, it's probably just runnig the code from my project, rather than using the installed bitfinex-api-py

I'm not sure what you mean by running pytest, or what your current code is.

For the sake of simplicity, and efficiency to fix your issue, I'd suggest that you:

  • remove the previously installed bitfinex-api-py
  • install it again (just to be sure that it runs and is setup) as mentioned above, with python3 -m pip install bitfinex-api-py
  • then run whatever code you want to run

If you installed this repo correctly, then you should not face any issue.

For a start I'd suggest that you try to launch python (the one used for the installation of this repo as a module - if you followed my above method of installation that should be python3).

Then you can directly use the CLI to test if it works with one of the examples that are in the repo here, such as the REST example to get public data

You can just copy and past one of the actions from there and test it out like so.

So just to add to this reply's quality (I hope) I'll paste the code below. You can past it to the CLI and see if it works.

import asyncio

from bfxapi import Client

bfx = Client(logLevel='DEBUG')


async def log_books():
    orders = await bfx.rest.get_public_books('tBTCUSD')
    print ("\nOrder book:\n")
    [print(o) for o in orders]


t = asyncio.ensure_future(log_books())
asyncio.get_event_loop().run_until_complete(t)

I hope this makes sense, and that it works!

Let me know if you face an error, and feel free to provide more details as to what happened exactly!

Cheers!