mirror of
https://github.com/linux-system-roles/network.git
synced 2026-01-23 18:35:13 +00:00
Merge pull request #129 from i386x/new-travis-ci-setup
Refactor Travis CI setup
This commit is contained in:
commit
5a1f9cfd40
9 changed files with 388 additions and 81 deletions
|
|
@ -1,3 +1,4 @@
|
|||
# SPDX-License-Identifier: MIT
|
||||
---
|
||||
dist: xenial
|
||||
language: python
|
||||
|
|
@ -7,21 +8,19 @@ matrix:
|
|||
dist: trusty
|
||||
- python: 2.7
|
||||
- python: 3.5
|
||||
env: aptpkgs=python3-selinux
|
||||
- python: 3.6
|
||||
- python: 3.7
|
||||
- python: 3.7-dev
|
||||
- python: 3.8-dev
|
||||
# - python: nightly
|
||||
|
||||
services:
|
||||
- docker
|
||||
|
||||
before_install:
|
||||
- if [ -n "${aptpkgs}" ]; then sudo apt-get install -y python3-selinux; fi
|
||||
- ./.travis/preinstall
|
||||
|
||||
install:
|
||||
- pip install tox tox-travis
|
||||
|
||||
script:
|
||||
- tox
|
||||
- ./.travis/runtox
|
||||
|
|
|
|||
13
.travis/config.sh
Normal file
13
.travis/config.sh
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
# SPDX-License-Identifier: MIT
|
||||
export LSR_MOLECULE_DEPS='-rmolecule_requirements.txt'
|
||||
|
||||
LSR_EXTRA_PACKAGES='python3-selinux'
|
||||
|
||||
case "${TRAVIS_PYTHON_VERSION}" in
|
||||
3.6|"")
|
||||
# Set these also if we are running locally:
|
||||
export LSR_TEXTRA_DEPS='PyYAML'
|
||||
export LSR_TEXTRA_DIR='tests'
|
||||
export LSR_TEXTRA_CMD='./ensure_non_running_provider.py'
|
||||
;;
|
||||
esac
|
||||
13
.travis/fix-coverage.sh
Executable file
13
.travis/fix-coverage.sh
Executable file
|
|
@ -0,0 +1,13 @@
|
|||
#!/bin/bash
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
set -ex
|
||||
|
||||
cat > .coveragerc <<EOF
|
||||
[paths]
|
||||
source =
|
||||
.
|
||||
$PWD
|
||||
EOF
|
||||
mv .coverage .coverage.merge
|
||||
coverage combine --append .
|
||||
18
.travis/preinstall
Executable file
18
.travis/preinstall
Executable file
|
|
@ -0,0 +1,18 @@
|
|||
#!/bin/bash
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
set -ex
|
||||
|
||||
SCRIPTDIR=$(dirname $0)
|
||||
CONFIG=${SCRIPTDIR}/config.sh
|
||||
|
||||
if [[ -f ${CONFIG} ]]; then
|
||||
. ${CONFIG}
|
||||
fi
|
||||
|
||||
if [[ "${LSR_EXTRA_PACKAGES}" ]]; then
|
||||
sudo apt-get update
|
||||
for P in ${LSR_EXTRA_PACKAGES}; do
|
||||
sudo apt-get install -y ${P} || :
|
||||
done
|
||||
fi
|
||||
16
.travis/runtox
Executable file
16
.travis/runtox
Executable file
|
|
@ -0,0 +1,16 @@
|
|||
#!/bin/bash
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
set -ex
|
||||
|
||||
SCRIPTDIR=$(dirname $0)
|
||||
CONFIG=${SCRIPTDIR}/config.sh
|
||||
|
||||
if [[ -f ${CONFIG} ]]; then
|
||||
. ${CONFIG}
|
||||
fi
|
||||
|
||||
tox "$@"
|
||||
for X in ${LSR_MSCENARIOS}; do
|
||||
LSR_MSCENARIO=${X} tox -e molecule
|
||||
done
|
||||
3
molecule_requirements.txt
Normal file
3
molecule_requirements.txt
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# SPDX-License-Identifier: MIT
|
||||
jmespath
|
||||
selinux
|
||||
11
pylintrc
11
pylintrc
|
|
@ -1,3 +1,5 @@
|
|||
# SPDX-License-Identifier: MIT
|
||||
|
||||
# This file was generated using `pylint --generate-rcfile > pylintrc` command.
|
||||
[MASTER]
|
||||
|
||||
|
|
@ -8,7 +10,7 @@ extension-pkg-whitelist=
|
|||
|
||||
# Add files or directories to the blacklist. They should be base names, not
|
||||
# paths.
|
||||
ignore=CVS
|
||||
ignore=.git,.tox
|
||||
|
||||
# Add files or directories matching the regex patterns to the blacklist. The
|
||||
# regex matches against base names, not paths.
|
||||
|
|
@ -16,8 +18,7 @@ ignore-patterns=
|
|||
|
||||
# Python code to execute, usually for sys.path manipulation such as
|
||||
# pygtk.require().
|
||||
init-hook="from pylint.config import find_pylintrc; import os, sys; sys.path.append(os.path.dirname(find_pylintrc()) + '/library'); sys.path.append(os.path.dirname(find_pylintrc()) + '/module_utils'); sys.path.append(os.path.dirname(find_pylintrc()) + '/tests')"
|
||||
|
||||
#init-hook=
|
||||
|
||||
# Use multiple processes to speed up Pylint.
|
||||
jobs=1
|
||||
|
|
@ -56,7 +57,7 @@ confidence=
|
|||
# --enable=similarities". If you want to run only the classes checker, but have
|
||||
# no Warning level messages displayed, use"--disable=all --enable=classes
|
||||
# --disable=W"
|
||||
disable=
|
||||
disable=wrong-import-position
|
||||
#disable=print-statement,
|
||||
# parameter-unpacking,
|
||||
# unpacking-in-except,
|
||||
|
|
@ -246,7 +247,7 @@ indent-after-paren=4
|
|||
indent-string=' '
|
||||
|
||||
# Maximum number of characters on a single line.
|
||||
max-line-length=100
|
||||
max-line-length=88
|
||||
|
||||
# Maximum number of lines in a module
|
||||
max-module-lines=1000
|
||||
|
|
|
|||
170
run_pylint.py
Normal file
170
run_pylint.py
Normal file
|
|
@ -0,0 +1,170 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
# Copyright (c) 2019 Red Hat, Inc.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
#
|
||||
"""
|
||||
Probe directory tree for python files and pass them to pylint.
|
||||
|
||||
Usage: python run_pylint.py ARGUMENTS
|
||||
|
||||
Run pylint with ARGUMENTS followed by the list of python files contained in the
|
||||
working directory and its subdirectories. As a python file is recognized a
|
||||
file that match INCPAT. Files and directories that match EXPAT are skipped.
|
||||
Symbolic links are also skipped.
|
||||
|
||||
There are several cases when argument from ARGUMENTS is not passed to pylint
|
||||
but it is handled by run_pylint.py instead:
|
||||
|
||||
1. if -h or --help is contained in ARGUMENTS, this help screen is printed to
|
||||
the standard output and run_pylint.py exits with 0;
|
||||
2. if --include followed by a PATTERN is contained in ARGUMENTS, the PATTERN
|
||||
is used instead of INCPAT to recognize whether the file is a python file
|
||||
or not;
|
||||
3. if --exclude followed by a PATTERN is contained in ARGUMENTS, the PATTERN
|
||||
is used instead of EXPAT to recognize whether the file or directory should
|
||||
be skipped.
|
||||
|
||||
Exclusion takes a priority over inclusion, i.e. if a file or directory can be
|
||||
both included and excluded, it is excluded.
|
||||
|
||||
The default value of INCPAT is .*\\.py[iw]?$. For EXPAT, it is ^\\..*.
|
||||
|
||||
Environment variables:
|
||||
|
||||
RUN_PYLINT_INCLUDE
|
||||
overrides default value of INCPAT;
|
||||
|
||||
RUN_PYLINT_EXCLUDE
|
||||
overrides default value of EXPAT;
|
||||
|
||||
RUN_PYLINT_DISABLED
|
||||
if set to an arbitrary non-empty value, pylint will be not executed
|
||||
"""
|
||||
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
|
||||
from colorama import Fore
|
||||
from pylint.lint import Run
|
||||
|
||||
|
||||
def blue(s):
|
||||
"""
|
||||
Return string `s` colorized to blue.
|
||||
"""
|
||||
|
||||
return "%s%s%s" % (Fore.BLUE, s, Fore.RESET)
|
||||
|
||||
|
||||
def print_line(s):
|
||||
"""
|
||||
Write `s` followed by the line feed character to the standard output.
|
||||
"""
|
||||
|
||||
sys.stdout.write("%s\n" % s)
|
||||
|
||||
|
||||
def probe_args():
|
||||
"""
|
||||
Analyze the command line arguments and return a tuple containing a list of
|
||||
pylint arguments, pattern string to recognize files to be included, and
|
||||
pattern string to recognize files and directories to be skipped.
|
||||
|
||||
Default values of pattern strings are taken from RUN_PYLINT_INCLUDE and
|
||||
RUN_PYLINT_EXCLUDE environment variables. In the case they are not defined,
|
||||
.*\\.py[iw]?$ and ^\\..* are used, respectively.
|
||||
"""
|
||||
|
||||
args = []
|
||||
include_pattern = os.getenv("RUN_PYLINT_INCLUDE", r".*\.py[iw]?$")
|
||||
exclude_pattern = os.getenv("RUN_PYLINT_EXCLUDE", r"^\..*")
|
||||
i, nargs = 1, len(sys.argv)
|
||||
while i < nargs:
|
||||
arg = sys.argv[i]
|
||||
if arg == "--include":
|
||||
i += 1
|
||||
assert i < nargs, "--include: missing PATTERN"
|
||||
include_pattern = sys.argv[i]
|
||||
elif arg == "--exclude":
|
||||
i += 1
|
||||
assert i < nargs, "--exclude: missing PATTERN"
|
||||
exclude_pattern = sys.argv[i]
|
||||
else:
|
||||
args.append(arg)
|
||||
i += 1
|
||||
return args, include_pattern, exclude_pattern
|
||||
|
||||
|
||||
def probe_dir(path, include_re, exclude_re):
|
||||
"""
|
||||
Recursively go through directory structure starting at `path`, collect
|
||||
files that match `include_re`, skip files and directories that are either
|
||||
symbolic links or match `exclude_re`. Return the list of collected files.
|
||||
"""
|
||||
|
||||
files = []
|
||||
for direntry in os.listdir(path):
|
||||
fullpath = os.path.join(path, direntry)
|
||||
if os.path.islink(fullpath) or exclude_re.match(direntry):
|
||||
continue
|
||||
elif os.path.isdir(fullpath):
|
||||
files.extend(probe_dir(fullpath, include_re, exclude_re))
|
||||
elif os.path.isfile(fullpath) and include_re.match(direntry):
|
||||
files.append(fullpath)
|
||||
return files
|
||||
|
||||
|
||||
def show_files(files):
|
||||
"""
|
||||
Print `files` to the standard output, one item per line, in a blue color.
|
||||
"""
|
||||
|
||||
if not files:
|
||||
return
|
||||
print_line(blue("%s: files to be checked:" % sys.argv[0]))
|
||||
for f in files:
|
||||
print_line(blue(" %s" % f))
|
||||
|
||||
|
||||
def main():
|
||||
"""
|
||||
Script entry point. Return exit code.
|
||||
"""
|
||||
|
||||
args, include_pattern, exclude_pattern = probe_args()
|
||||
if "-h" in args or "--help" in args:
|
||||
print_line(__doc__)
|
||||
return 0
|
||||
if os.getenv("RUN_PYLINT_DISABLED", "") != "":
|
||||
return 0
|
||||
files = probe_dir(
|
||||
os.getcwd(), re.compile(include_pattern), re.compile(exclude_pattern)
|
||||
)
|
||||
show_files(files)
|
||||
args.extend(files)
|
||||
sys.argv[0] = "pylint"
|
||||
return Run(args, None, False).linter.msg_status
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
218
tox.ini
218
tox.ini
|
|
@ -1,23 +1,20 @@
|
|||
# SPDX-License-Identifier: MIT
|
||||
[tox]
|
||||
envlist = black, flake8, pylint, py{26,27,36,37}, ensure_non_running_provider
|
||||
envlist =
|
||||
black, pylint, flake8,
|
||||
py{26,27,36,37,38},
|
||||
extra
|
||||
skipsdist = true
|
||||
skip_missing_interpreters = True
|
||||
skip_missing_interpreters = true
|
||||
|
||||
[testenv]
|
||||
basepython = python3
|
||||
# List common dependencies for Python interpreters here:
|
||||
deps =
|
||||
py{26,27,36,37,38}: pytest-cov
|
||||
py{27,36,37,38}: pytest>=3.5.1
|
||||
py{26,27}: mock
|
||||
py26: pytest
|
||||
molecule_{lint,syntax,test}: docker
|
||||
molecule_{lint,syntax,test}: jmespath
|
||||
molecule_{lint,syntax,test}: molecule
|
||||
# The selinux pypi shim does not work with Ubuntu (as used by Travis), yet.
|
||||
# Therefore use a fork with Ubuntu support. This can be changed once the
|
||||
# update is available on PyPi.
|
||||
# molecule_{lint,syntax,test}: selinux
|
||||
molecule_{lint,syntax,test}: git+https://github.com/tyll/selinux-pypi-shim@fulllocation
|
||||
|
||||
[base]
|
||||
passenv = *
|
||||
|
|
@ -28,139 +25,216 @@ changedir = {toxinidir}/tests
|
|||
covtarget = {toxinidir}/library --cov {toxinidir}/module_utils
|
||||
pytesttarget = .
|
||||
|
||||
[testenv:black]
|
||||
deps = black
|
||||
|
||||
commands = black --check --diff --include "^[^.].*\.py$" .
|
||||
|
||||
[testenv:py26]
|
||||
install_command = pip install {opts} {packages}
|
||||
list_dependencies_command = pip freeze
|
||||
envdir = {toxworkdir}/env-{env:TRAVIS_PYTHON_VERSION:2.6}
|
||||
install_command =
|
||||
pip install {opts} {packages}
|
||||
list_dependencies_command =
|
||||
pip freeze
|
||||
basepython = python2.6
|
||||
passenv = {[base]passenv}
|
||||
setenv =
|
||||
{[base]setenv}
|
||||
changedir = {[base]changedir}
|
||||
commands =
|
||||
pytest \
|
||||
--durations=5 \
|
||||
--cov={[base]covtarget} \
|
||||
--cov-report=html:htmlcov-py26 --cov-report=term \
|
||||
{posargs} \
|
||||
{[base]pytesttarget}
|
||||
pytest --durations=5 \
|
||||
--cov={[base]covtarget} \
|
||||
--cov-report=html:htmlcov-py26 \
|
||||
--cov-report=term \
|
||||
{posargs} \
|
||||
{[base]pytesttarget}
|
||||
|
||||
[testenv:py27]
|
||||
envdir = {toxworkdir}/env-{env:TRAVIS_PYTHON_VERSION:2.7}
|
||||
basepython = python2.7
|
||||
passenv = {[base]passenv}
|
||||
setenv =
|
||||
{[base]setenv}
|
||||
changedir = {[base]changedir}
|
||||
commands =
|
||||
pytest \
|
||||
--durations=5 \
|
||||
--cov={[base]covtarget} \
|
||||
--cov-report=html:htmlcov-py27 --cov-report=term \
|
||||
{posargs} \
|
||||
{[base]pytesttarget}
|
||||
pytest --durations=5 \
|
||||
--cov={[base]covtarget} \
|
||||
--cov-report=html:htmlcov-py27 \
|
||||
--cov-report=term \
|
||||
{posargs} \
|
||||
{[base]pytesttarget}
|
||||
|
||||
[testenv:py36]
|
||||
envdir = {toxworkdir}/env-{env:TRAVIS_PYTHON_VERSION:3.6}
|
||||
basepython = python3.6
|
||||
passenv = {[base]passenv}
|
||||
setenv =
|
||||
{[base]setenv}
|
||||
changedir = {[base]changedir}
|
||||
commands =
|
||||
pytest \
|
||||
--durations=5 \
|
||||
--cov={[base]covtarget} \
|
||||
--cov-report=html:htmlcov-py36 --cov-report=term \
|
||||
{posargs} \
|
||||
{[base]pytesttarget}
|
||||
pytest --durations=5 \
|
||||
--cov={[base]covtarget} \
|
||||
--cov-report=html:htmlcov-py36 \
|
||||
--cov-report=term \
|
||||
{posargs} \
|
||||
{[base]pytesttarget}
|
||||
|
||||
[testenv:py37]
|
||||
envdir = {toxworkdir}/env-{env:TRAVIS_PYTHON_VERSION:3.7}
|
||||
basepython = python3.7
|
||||
passenv = {[base]passenv}
|
||||
setenv =
|
||||
{[base]setenv}
|
||||
changedir = {[base]changedir}
|
||||
commands =
|
||||
pytest \
|
||||
--durations=5 \
|
||||
--cov={[base]covtarget} \
|
||||
--cov-report=html:htmlcov-py37 --cov-report=term \
|
||||
{posargs} \
|
||||
{[base]pytesttarget}
|
||||
pytest --durations=5 \
|
||||
--cov={[base]covtarget} \
|
||||
--cov-report=html:htmlcov-py37 \
|
||||
--cov-report=term \
|
||||
{posargs} \
|
||||
{[base]pytesttarget}
|
||||
|
||||
[testenv:py38]
|
||||
envdir = {toxworkdir}/env-{env:TRAVIS_PYTHON_VERSION:3.8}
|
||||
basepython = python3.8
|
||||
passenv = {[base]passenv}
|
||||
setenv =
|
||||
{[base]setenv}
|
||||
changedir = {[base]changedir}
|
||||
basepython = python3.8
|
||||
commands =
|
||||
pytest \
|
||||
--durations=5 \
|
||||
--cov={[base]covtarget} \
|
||||
--cov-report=html:htmlcov-py38 --cov-report=term \
|
||||
{posargs} \
|
||||
{[base]pytesttarget}
|
||||
pytest --durations=5 \
|
||||
--cov={[base]covtarget} \
|
||||
--cov-report=html:htmlcov-py38 \
|
||||
--cov-report=term \
|
||||
{posargs} \
|
||||
{[base]pytesttarget}
|
||||
|
||||
[testenv:black]
|
||||
envdir = {toxworkdir}/env-{env:TRAVIS_PYTHON_VERSION:3.6}
|
||||
basepython = python3.6
|
||||
deps =
|
||||
black
|
||||
commands =
|
||||
black --check --diff --include "^[^.].*\.py$" --exclude "/(\.[^.].*|tests/roles)/" .
|
||||
|
||||
[testenv:pylint]
|
||||
envdir = {toxworkdir}/env-{env:TRAVIS_PYTHON_VERSION:2.7}
|
||||
basepython = python2.7
|
||||
passenv = RUN_PYLINT_*
|
||||
setenv =
|
||||
{[base]setenv}
|
||||
deps =
|
||||
colorama
|
||||
pylint>=1.8.4
|
||||
ansible
|
||||
commands =
|
||||
pylint \
|
||||
--errors-only \
|
||||
{posargs} \
|
||||
library/network_connections.py \
|
||||
module_utils/network_lsr \
|
||||
tests/unit/test_network_connections.py
|
||||
{envpython} ./run_pylint.py --errors-only {posargs}
|
||||
|
||||
[testenv:flake8]
|
||||
envdir = {toxworkdir}/env-{env:TRAVIS_PYTHON_VERSION:2.7}
|
||||
basepython = python2.7
|
||||
deps =
|
||||
flake8>=3.5
|
||||
whitelist_externals = flake8
|
||||
commands=
|
||||
flake8 --statistics {posargs} \
|
||||
.
|
||||
commands =
|
||||
flake8 --statistics {posargs} .
|
||||
|
||||
[testenv:coveralls]
|
||||
basepython = python2.7
|
||||
envdir = {toxworkdir}/env-{env:TRAVIS_PYTHON_VERSION:coveralls}
|
||||
passenv = TRAVIS TRAVIS_*
|
||||
whitelist_externals = bash
|
||||
deps =
|
||||
coveralls
|
||||
changedir = {[base]changedir}
|
||||
commands =
|
||||
bash -c 'cd ..; bash .travis/fix-coverage.sh; cd -'
|
||||
coveralls
|
||||
|
||||
[testenv:ensure_non_running_provider]
|
||||
# LSR_MOLECULE_DEPS may contain aditional Molecule dependencies. For example,
|
||||
# in `network` system role, LSR_MOLECULE_DEPS can be set as
|
||||
#
|
||||
# LSR_MOLECULE_DEPS='-rmolecule_requirements.txt'
|
||||
#
|
||||
# where `molecule_requirements.txt` contains two lines:
|
||||
#
|
||||
# jmespath
|
||||
# selinux
|
||||
#
|
||||
[molecule_common]
|
||||
deps =
|
||||
PyYAML
|
||||
changedir = {toxinidir}/tests
|
||||
commands = {toxinidir}/tests/ensure_non_running_provider.py
|
||||
docker
|
||||
molecule
|
||||
{env:LSR_MOLECULE_DEPS:}
|
||||
|
||||
[testenv:molecule_lint]
|
||||
envdir = {toxworkdir}/env-{env:TRAVIS_PYTHON_VERSION:molecule}
|
||||
deps =
|
||||
{[molecule_common]deps}
|
||||
commands_pre =
|
||||
molecule --version
|
||||
ansible --version
|
||||
commands = molecule {posargs} lint
|
||||
commands =
|
||||
molecule lint -s {env:LSR_MSCENARIO:default} {posargs}
|
||||
|
||||
[testenv:molecule_syntax]
|
||||
commands = molecule {posargs} syntax
|
||||
envdir = {toxworkdir}/env-{env:TRAVIS_PYTHON_VERSION:molecule}
|
||||
deps =
|
||||
{[molecule_common]deps}
|
||||
commands =
|
||||
molecule syntax -s {env:LSR_MSCENARIO:default} {posargs}
|
||||
|
||||
[testenv:molecule_test]
|
||||
commands = molecule {posargs} test
|
||||
envdir = {toxworkdir}/env-{env:TRAVIS_PYTHON_VERSION:molecule}
|
||||
deps =
|
||||
{[molecule_common]deps}
|
||||
commands =
|
||||
molecule test -s {env:LSR_MSCENARIO:default} {posargs}
|
||||
|
||||
[testenv:molecule]
|
||||
envdir = {toxworkdir}/env-{env:TRAVIS_PYTHON_VERSION:molecule}
|
||||
deps =
|
||||
{[molecule_common]deps}
|
||||
commands_pre =
|
||||
{[testenv:molecule_lint]commands_pre}
|
||||
commands =
|
||||
{[testenv:molecule_lint]commands}
|
||||
{[testenv:molecule_syntax]commands}
|
||||
{[testenv:molecule_test]commands}
|
||||
|
||||
# Here we provide a way how a role can add its custom command to be run. Such
|
||||
# extra command is run at the end of each testenv run and is driven by
|
||||
# environment variables. Involved environment variables are:
|
||||
#
|
||||
# LSR_TEXTRA_DEPS
|
||||
# - contains dependency needed by commands to run smoothly; if more than
|
||||
# one dependency is needed, use external file together with '-r' option
|
||||
# (see PEP 508)
|
||||
#
|
||||
# LSR_TEXTRA_DIR
|
||||
# - directory to which to cd
|
||||
#
|
||||
# LSR_TEXTRA_CMD
|
||||
# - custom command to be run
|
||||
#
|
||||
# Example: `network` system role need to run `./tests/ensure_non_running_provider.py`
|
||||
# to check for the existence of `*_provider.yml` playbooks. The script
|
||||
# is run in Python 3.6.
|
||||
#
|
||||
# To make this possible, we add to `.travis/config.sh` a snippet:
|
||||
#
|
||||
# export LSR_TEXTRA_DEPS='PyYAML'
|
||||
# export LSR_TEXTRA_DIR='tests'
|
||||
# export LSR_TEXTRA_CMD='./ensure_non_running_provider.py'
|
||||
#
|
||||
[testenv:extra]
|
||||
envdir = {toxworkdir}/env-{env:TRAVIS_PYTHON_VERSION:extra}
|
||||
deps =
|
||||
{env:LSR_TEXTRA_DEPS:}
|
||||
passenv = *
|
||||
changedir = {toxinidir}/{env:LSR_TEXTRA_DIR:.}
|
||||
commands =
|
||||
{env:LSR_TEXTRA_CMD:python --version}
|
||||
|
||||
[pytest]
|
||||
addopts = -rxs
|
||||
|
||||
[flake8]
|
||||
show_source = True
|
||||
show_source = true
|
||||
max-line-length = 88
|
||||
ignore = E402,W503
|
||||
|
||||
|
|
@ -173,9 +247,9 @@ max-line-length = 88
|
|||
|
||||
[travis]
|
||||
python =
|
||||
2.6: py26
|
||||
2.7: py27,coveralls,flake8,pylint
|
||||
3.5: molecule_lint,molecule_syntax,molecule_test
|
||||
3.6: py36,black,ensure_non_running_provider
|
||||
3.7: py37
|
||||
3.8: py38
|
||||
2.6: py26,extra
|
||||
2.7: py27,flake8,pylint,extra
|
||||
3.5: coveralls,molecule,extra
|
||||
3.6: py36,black,extra
|
||||
3.7: py37,extra
|
||||
3.8: py38,extra
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue