Yoh*_*hei 6 python pytest python-poetry
不顺利的是在 nox 会话中安装 dev 依赖项。
我有noxfile.py如下所示:
import nox
from nox.sessions import Session
from pathlib import Path
__dir__ = Path(__file__).parent.absolute()
@nox.session(python=PYTHON)
def test(session: Session):
session.install(str(__dir__)) # I want to use dev dependency here
session.run("pytest")
Run Code Online (Sandbox Code Playgroud)
如何在 nox 会话中安装开发依赖项?
目前session.install不支持poetry,install仅在 shell 中运行 pip 。您可以poetry使用更通用的方法来激活session.run。
例子:
@nox.session(python=False)
def tests(session):
session.run('poetry', 'shell')
session.run('poetry', 'install')
session.run('pytest')
Run Code Online (Sandbox Code Playgroud)
当您设置会话时,您可以通过自己禁用 python virtualenv ( python=False) 的创建并激活poetry的 来完成所有操作poetry shell。
| 归档时间: |
|
| 查看次数: |
1477 次 |
| 最近记录: |