Skip to main content

在 Travis-CI `.travis.yml` 文件和 Tox `tox.ini` 文件之间转换

项目描述

https://secure.travis-ci.org/msabramo/python-panci.png

对于 Python 项目,获取一个.travis.yml文件 ( Travis CI ) 并输出一个 tox.ini文件 ( Tox )。或相反亦然。

为什么叫这个名字?

“panci”这个名字是对John MacFarlane的优秀pandoc的致敬。我用“ci”替换了“doc”;“CI”代表持续集成,这是Travis CITox为您提供帮助的广义术语。

安装

用点子:

pip install panci

例子

特拉维斯到毒物

假设我们有以下.travis.yml

language: python

python:
  - 2.6
  - 2.7
  - 3.2
  - pypy

script: python setup.py test

如果我们运行:

panci --to=tox .travis.yml

然后我们得到:

# Tox (http://tox.testrun.org/) is a tool for running tests
# in multiple virtualenvs. This configuration file will run the
# test suite on all supported python versions. To use it, "pip install tox"
# and then run "tox" from this directory.

[tox]
envlist = <s>py26, py27, py32, pypy</s>

[testenv]
commands = <s>python setup.py test</s>

对特拉维斯的毒药

假设我们有以下tox.ini

[tox]
envlist = <s>py26, py27, py33, pypy</s>

[testenv]
commands = <s>py.test</s>
deps = <s>pytest</s>

如果我们运行:

panci tox.ini

然后我们得到:

language: python
env:
  - TOXENV=py26
  - TOXENV=py27
  - TOXENV=py33
  - TOXENV=pypy
install:
  - travis_retry pip install tox==1.6.1
script:
  - travis_retry tox

panci-tox-quickstart

如果我们运行:

panci-tox-quickstart

然后你会被问到一些问题:

This utility will ask you a few questions and then generate a simple tox.ini
file to help get you started using tox.

Please enter values for the following settings (just press Enter to
accept a default value, if one is given in brackets).

> Test your project with py24 (Y/n) [Y]: n
> Test your project with py25 (Y/n) [Y]: n
> Test your project with py26 (Y/n) [Y]:
> Test your project with py27 (Y/n) [Y]:
> Test your project with py30 (Y/n) [Y]:
> Test your project with py31 (Y/n) [Y]:
> Test your project with py32 (Y/n) [Y]:
> Test your project with py33 (Y/n) [Y]:
> Test your project with pypy (Y/n) [Y]:
> Test your project with jython (Y/n) [Y]: n

What command should be used to test your project -- examples:
    - python setup.py test
    - nosetests package.module
    - trial package.module
> Command to run to test project [{envpython} setup.py test]:

What dependencies does your project have?
> Comma-separated list of dependencies [ ]: requests,nose

Creating file tox.ini.

Finished: A tox.ini file has been created.

Execute `tox` to test your project.

然后吐出一个tox.ini文件:

# Tox (http://tox.testrun.org/) is a tool for running tests
# in multiple virtualenvs. This configuration file will run the
# test suite on all supported python versions. To use it, "pip install tox"
# and then run "tox" from this directory.

[tox]
envlist = <s>py26, py27, py30, py31, py32, py33, pypy</s>

[testenv]
commands = <s>{envpython} setup.py test</s>
deps =
    requests
    nose

关于panci-tox-quickstart 的注意事项:我还在长期致力于将 tox-quickstart命令合并到 tox 中。请参阅此拉取请求

支持

如有问题、意见和建议,请使用GitHub 问题

项目详情


下载文件

下载适用于您平台的文件。如果您不确定要选择哪个,请了解有关安装包的更多信息。

源分布

panci-0.0.2.tar.gz (10.3 kB 查看哈希)

已上传 source

内置分布

panci-0.0.2-py2.py3-none-any.whl (12.4 kB 查看哈希

已上传 py2 py3