Virtual environments names are now based on the version of Python
interpreter that is used. This prevents creation of redundant
environments, that is there will be only one[1] virtual environment
per Python interpreter, which saves the time by preventing the
installation of the same packages more than once.
[1] In Travis CI, this is easy to implement by using the
TRAVIS_PYTHON_VERSION environment variable. Locally, as there
is no information about what version of Python interpreter is
used when creating a virtual environment in tox, there may be
more virtual environments per interpreter (for example, env-3.6
and env-molecule may be both based on Python 3.6).
Add run_pylint.py that probe working directory for python source files
and pass them to pylint. This is needed because pylint expects module
or package, so passing a directory with no __init__.py in it makes
pylint angry. With this change, LSR_PYLINT_DIRS is no longer needed.
Additionally, we no longer need:
- init-hook in pylintrc
- [pylintrc] section in tox.ini, because the configuration from this
section is now the part of pylintrc
- [pycodestyle] section in tox.ini, because pycodestyle linter is not
used
- use `./.travis/runtox [ARG1 [ARG2 [...[ARGn]]]]` to run tox locally
- use LSR_USE_PYTHON to decide whether to run jobs with pylinters and
pytesters or not
This commit introduces the refactored Travis CI setup and tox.ini
to fullfil the need to have common CI setup across all roles.
The current proposal and discussion can be found at:
https://github.com/linux-system-roles/template/issues/4
Fedora 30 uses tox 3 which does not work with Python 2.6 out of the box.
Setting the install and list_dependencies commands to run `pip` instead
of `python -m pip` seems to fix this for now.
This removes warnings like:
[WARNING]: The value False (type bool) in a string field was converted
to u'False' (type string). If this does not look like what you expect,
quote the entire value to ensure it does not change.
A symlink like
ansible -> ../..
in module_utils/network_lsr breaks the copy task with a strange error
message:
An exception occurred during task execution. To see the full traceback,
use -vvv. The error was: FileNotFoundError: [Errno 2] No such file or
directory: ''
Avoiding following symlinks helps here. The symlink makes it easier to
import the files since the import paths include ansible as a component:
from ansible.module_utils.network_lsr.utils import Util