【问题标题】:Can I use Tox to test two packages that are developed side-by-side?我可以使用 Tox 测试并排开发的两个包吗?
【发布时间】:2018-11-02 19:12:38
【问题描述】:

我在同一个 repo 中有两个 Python 包 - 一个是自动生成的低级 REST 客户端(来自 openapi-generator),另一个是使用这些低级方法来实现更高级别目标的包装器。

当我生成的 API 定义发生变化时,我经常需要对包装器进行相应的更改。因此,当我运行测试时,它需要从我的工作目录中获取两个包的版本。例如,我可以这样做:

virtualenv env
source env/bin/activate
pip install -e autogen_client
pip install -e wrapper
py.test wrapper/tests/

有没有办法让toxvirtualenvpip 混在一起?就像你能在deps 字段中给出相对路径吗?还是我的用例很奇怪,我只需要自己做?

【问题讨论】:

    标签: python testing pytest tox


    【解决方案1】:

    事实证明是的,你可以让 tox 变成这样。

    [tox]
    envlist = py35,py36
    skipsdist = True  # since there's no top-level package
    
    [testenv]
    deps =
        -eautogen_client
        -ewrapper
        pytest
    
    commands =
        py.test wrapper/tests/
    

    不错!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-11-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多