跳转到主要内容

在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的致敬。我将“doc”替换为“ci”;“CI”代表持续集成,这是一个广泛的术语,指的是Travis CITox可以帮助您完成的事情。

安装

使用pip

pip install panci

示例

从Travis到Tox

假设我们有以下 .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 = py26, py27, py32, pypy

[testenv]
commands = python setup.py test

从Tox到Travis

假设我们有以下 tox.ini

[tox]
envlist = py26, py27, py33, pypy

[testenv]
commands = py.test
deps = pytest

如果我们运行

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 = py26, py27, py30, py31, py32, py33, pypy

[testenv]
commands = {envpython} setup.py test
deps =
    requests
    nose

关于 panci-tox-quickstart 的说明:我还在努力将 tox-quickstart 命令合并到 tox 中。请参阅 这个 pull request

支持

对于问题、评论和建议,请使用 GitHub Issues

项目详情


下载文件

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

源分布

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

上传时间

构建分布

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

上传时间 Python 2 Python 3

支持者