pytest - 是否可以指向 tox 从分支中提取依赖项(又名在幕后使用 `pip -e`)?

标签 pytest pypi tox

当py37更改未打包到pypi时如何在tox中测试py27和py37

  • repo 分支中存在与 py3.7 兼容的更改。
  • 它们可以通过 pip -e 手动运行,安装它们并运行 pytest 而不使用 tox。
  • 我想通过 tox 运行它们,但我无法找出正确的字符串来提供 deps 列表,或者这可能是通过另一种方式完成的。

  • 尝试的解决方案:

    配置文件
    [tox]
    envlist = py27,py37
    
    
    [testenv:py27]
    deps =
        pytest
        pytest-cov
        pytest-mock
        pylint
        ; packages specified by the setup.py cover the other dependencies for py2.7
    commands =
        pytest -v
    
    
    [testenv:py37]
    deps =
        pytest
        pytest-cov
        pytest-mock
        pylint
        git+ssh//repo_url/location1.git@branchname_that_supports_py37
        git+ssh//repo_url/location2.git@branchname_that_supports_py37
        git+ssh//repo_url/location3.git@branchname_that_supports_py37
        git+ssh//repo_url/location4.git@branchname_that_supports_py37
        git+ssh//repo_url/location5.git@branchname_that_supports_py37
        git+ssh//repo_url/location6.git@branchname_that_supports_py37
        git+ssh//repo_url/location7.git@branchname_that_supports_py37
        git+ssh//repo_url/location8.git@branchname_that_supports_py37
    
    commands =
        pytest -v
    

    最佳答案

    对于 VCS URL pip需要知道应该与#egg=name一起提供的包的名称:

        git+ssh//repo_url/location1.git@branchname_that_supports_py37#egg=package1
    

    否则你的 tox.ini看起来挺好的。我use例如,相同的方法。

    关于pytest - 是否可以指向 tox 从分支中提取依赖项(又名在幕后使用 `pip -e`)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56046209/

    相关文章:

    python - Pytest Hook 导致测试多次运行

    python - 在 PyPI 上分发时我应该针对哪些架构和操作系统?

    python - 如何将图像添加到 Python 包索引文档中?

    Python/tox,在测试前启动一个进程,完成后关闭它

    python - 测试可选包的警告

    pytest - 在 setup_module 中使用 funcargs

    python - pytest stdout 从测试输出刷新到不同的文件

    python - Pytest,断言而不破坏程序流程

    python - 如何确保 pip 从内部 pypi 获取包?

    python - 使用 tox 在 Windows 上设置多个 python 安装