سؤال

A travis build, which uses

install:
    pip install unittest2

fails on Python 3 since unittest2 does not support Python 3. Is there a way to ignore that row for Python 3 builds, or just generally to ignore errors with that installation.

هل كانت مفيدة؟

المحلول

Travis provides links to a few example projects that use different versions of python.

I'm a fan of the tornado one, as it shows how you can manage each version very explicitly.

install:
    - if [[ $TRAVIS_PYTHON_VERSION == 2* ]]; then pip install unittest2; fi

Using this line, unittest2 will only install on the 2.x branch of Python. You can add further if/fi statements to tune your installs for the Python 3.x branch.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top