我正在尝试运行这些异步测试,我通过在该库的根目录中从命令行运行它来运行它们node run-tests gateio --python-async
下面的代码会导致弃用警告,因为我使用的东西(tox)依赖于python3.10
它看起来像get_event_loop
被弃用了python3.10
if __name__ == '__main__':
asyncio.get_event_loop().run_until_complete(main())
弃用警告
[100%] Testing gateio WARN (testExchange @ run-tests.js:172)
WARN gateio (Python 3 Async): (explain @ run-tests.js:191)
/path/ccxt/python/ccxt/test/test_async.py:558: DeprecationWarning: There is no current event loop
asyncio.get_event_loop().run_until_complete(main())
gateio using proxy ``
EXCHANGE: gateio
SYMBOL: BTC/USD
CODE: ZRX
gateio BTC/USD ticker None high: 65609.0 low: 64073.0 bid: 64958.24 ask: 64991.5 volume: 40525928.149905
gateio fetched all 2176 tickers
gateio fetched 10 OHLCVs
gateio BTC/USD order book 2021-11-12T03:25:31.759Z bid: 64958.24 bidVolume: 0.3225 ask: 64991.5 askVolume: 0.3225
gateio BTC/USD fetched 100 trades
gateio BTC/USD fetch_orders() not supported
gateio BTC/USD fetched 0 open orders
gateio BTC/USD fetched 0 closed orders
gateio ZRX fetch_transactions() not supported
gateio fetched balance (explain @ run-tests.js:193)
WARN ["gateio"] (run-tests.js:272)
All done, 1 warnings (run-tests.js:276)
我试图更新这一行,改为使用asyncio.run
,但后来我得到一个无限循环,最终测试超时并失败
asyncio.run(main(), debug=True)
超时错误
[100%] Testing gateio FAIL (testExchange @ run-tests.js:172)
FAILED gateio (Python 3 Async): (explain @ run-tests.js:190)
timed out (explain @ run-tests.js:193)
FAIL ["gateio"] (run-tests.js:271)
All done, 1 failed (run-tests.js:276)
我想知道如何正确更新此方法,以免收到弃用警告并且不会超时