【发布时间】:2021-12-24 11:45:21
【问题描述】:
我正在尝试运行these asyncronyous tests,我通过在此库的根目录node run-tests gateio --python-async 中从命令行运行它们来运行它们
下面的代码会导致弃用警告,因为我正在使用依赖于 python3.10 的东西 (tox),看起来 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)
我想知道如何正确更新此方法,以免收到弃用警告,也不会超时
【问题讨论】:
标签: python python-asyncio python-3.10