From df4adda119f7703d6d1022d09dabdafd61e086b6 Mon Sep 17 00:00:00 2001 From: Rachid Date: Mon, 3 Jun 2019 23:22:24 +0200 Subject: [PATCH] Add tox for tests --- .gitignore | 3 +++ .travis.yml | 9 +++------ molecule/default/molecule.yml | 4 ++-- ci-requirement.txt => requirements.txt | 1 - tox.ini | 18 ++++++++++++++++++ 5 files changed, 26 insertions(+), 9 deletions(-) rename ci-requirement.txt => requirements.txt (66%) create mode 100644 tox.ini diff --git a/.gitignore b/.gitignore index 12b5321..a17edbf 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,6 @@ *.log *.pytest_cache/ + +# Tox +.tox/ \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 28a7f02..05282b9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,13 +4,10 @@ language: python services: - docker before_install: - - curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - - - sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" - - sudo apt-get update - - sudo apt-get -y install docker-ce + - sudo apt-get -qq update install: - - pip install -r ci-requirement.txt + - pip install tox-travis script: - - molecule test -s default + - tox notifications: webhooks: https://galaxy.ansible.com/api/v1/notifications/ diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml index b03634f..8cd6276 100644 --- a/molecule/default/molecule.yml +++ b/molecule/default/molecule.yml @@ -10,10 +10,10 @@ driver: lint: name: yamllint platforms: - - name: sb_centos6 + - name: sb_centos6-$TOX_ENVNAME image: centos:6 privileged: True - - name: sb_centos7 + - name: sb_centos7-$TOX_ENVNAME image: centos:7 privileged: True command: '/sbin/init' diff --git a/ci-requirement.txt b/requirements.txt similarity index 66% rename from ci-requirement.txt rename to requirements.txt index a9b186c..7d89fa7 100644 --- a/ci-requirement.txt +++ b/requirements.txt @@ -1,3 +1,2 @@ -ansible==2.4.5 molecule==2.19.0 docker<3.0.0 diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..f0c9e23 --- /dev/null +++ b/tox.ini @@ -0,0 +1,18 @@ +[tox] +minversion = 3.4.0 +envlist = py{27,36}-ansible{24,25,26,27} +skipsdist = true + +[testenv] +passenv = * +deps = + -rrequirements.txt + ansible24: ansible>=2.4,<2.5 + ansible25: ansible>=2.5,<2.6 + ansible26: ansible>=2.6,<2.7 + ansible27: ansible>=2.7,<2.8 +commands = + molecule test -s default +setenv = + TOX_ENVNAME={envname} + MOLECULE_EPHEMERAL_DIRECTORY=/tmp/{envname}