• tox包


    官方文档

    https://tox.readthedocs.io/en/latest/example/basic.html
    

    官方提供的一个简单的tox.ini/默认环境

    [tox]
    envlist = py27,py36
    [testenv]
    deps = pytest
    commands = pytest
    

    运行

    >>>: tox  # 同时创建两个virtualenv环境,并打包安装到环境中
    >>>: tox -e py36  # 限制只在py3.6环境中运行
    

    大致配置分析

    [tox]
    minversion = 2.0 # 指定最小版本
    envlist = py27,py36  # 指定要使用的环境列表
    [testenv]  # 测试环境
    skipsdist = True  # 跳过打包环节
    #[testenv:py36]  # 指定具体版本的测试环境
    basepython = python3.7  # 配置python解释器版本
    deps = pytest
    # deps = -rrequirements.txt   # 读取requirements.txt文件中所有的安装包
    # deps = {toxinidir}/requirements.txt # tox.ini所在目录作为当前目录来执行安装
    # deps = django22: Django>=2.2,<2.3  # 指定具体的版本安装
    setenv =  # 设置环境变量
      PIP_INDEX_URL = https://pypi.my-alternative-index.org # 指定源
    commands = pytest # 运行命令
    commands = - coverage html  # -表示忽略命令
    commands = pytest --basetemp="{envtmpdir}" {posargs}  # 更改pytest tempdir并从命令行添加posargs
    allowlist_externals = make  # 使用不包含在virtualenv工具的命令解析器
    # allowlist_externals = /bin/bash
    

    基本目录结构

      - tox.ini
      - setup.py
      - tests
    

    -------------------------------------------

    个性签名:代码过万,键盘敲烂!!!

    如果觉得这篇文章对你有小小的帮助的话,记得在右下角点个“推荐”哦,博主在此感谢!

  • 相关阅读:
    easyui-layout完整web界面布局
    combobox中动态载入tree数据
    easyui---layout 有无横的间隔 的区别 split:true
    单选按钮radio获取选中的值
    Datagrid清空数据
    Lancher3默认桌面显示
    菜单背景全透效果
    android通过耳机控制音乐播放器
    android 音乐暂停
    Android 系统默认音量和最大音量
  • 原文地址:https://www.cnblogs.com/weiweivip666/p/14662225.html
Copyright © 2020-2023  润新知