From 6ce4fde82074c82e762fd7c56f2b5901f0705d09 Mon Sep 17 00:00:00 2001 From: Dimitri Savineau Date: Fri, 25 Oct 2019 15:47:05 -0400 Subject: [PATCH] move library/plugins tests files under tests dir To avoid unnecessary ansible warnings during playbook execution we can move the library and plugins test files under a different directory. [WARNING]: Skipping plugin (plugins/filter/test_ipaddrs_in_ranges.py) as it seems to be invalid: cannot import name 'ipaddrs_in_ranges' Closes: #4656 Signed-off-by: Dimitri Savineau --- .travis.yml | 2 +- {library => tests/library}/test_ceph_crush.py | 4 +++- {library => tests/library}/test_ceph_key.py | 4 +++- {library => tests/library}/test_ceph_volume.py | 4 +++- {plugins => tests/plugins}/filter/test_ipaddrs_in_ranges.py | 4 +++- 5 files changed, 13 insertions(+), 5 deletions(-) rename {library => tests/library}/test_ceph_crush.py (98%) rename {library => tests/library}/test_ceph_key.py (99%) rename {library => tests/library}/test_ceph_volume.py (99%) rename {plugins => tests/plugins}/filter/test_ipaddrs_in_ranges.py (95%) diff --git a/.travis.yml b/.travis.yml index 73c331db8..d9a1c9365 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,5 +9,5 @@ install: - pip install ansible-lint pytest script: - if [[ -n $(grep --exclude-dir=.git -P "\xa0" -r .) ]]; then echo 'NBSP characters found'; exit 1; fi - - pytest -vvvv library/ plugins/ + - pytest -vvvv tests/library/ tests/plugins/filter/ - for i in $(ls -1 roles/); do ANSIBLE_LOG_PATH=/dev/null ansible-lint -x 204 -v roles/$i/; if [ $? -ne 0 ]; then exit 1; fi; done diff --git a/library/test_ceph_crush.py b/tests/library/test_ceph_crush.py similarity index 98% rename from library/test_ceph_crush.py rename to tests/library/test_ceph_crush.py index 7c46b4abb..becd7f88b 100644 --- a/library/test_ceph_crush.py +++ b/tests/library/test_ceph_crush.py @@ -1,4 +1,6 @@ -from . import ceph_crush +import sys +sys.path.append('./library') +import ceph_crush import pytest diff --git a/library/test_ceph_key.py b/tests/library/test_ceph_key.py similarity index 99% rename from library/test_ceph_key.py rename to tests/library/test_ceph_key.py index 3350e1a62..b06178e3a 100644 --- a/library/test_ceph_key.py +++ b/tests/library/test_ceph_key.py @@ -1,6 +1,8 @@ import json import os -from . import ceph_key +import sys +sys.path.append('./library') +import ceph_key import mock diff --git a/library/test_ceph_volume.py b/tests/library/test_ceph_volume.py similarity index 99% rename from library/test_ceph_volume.py rename to tests/library/test_ceph_volume.py index cf0d9ff64..1254c1c7a 100644 --- a/library/test_ceph_volume.py +++ b/tests/library/test_ceph_volume.py @@ -1,4 +1,6 @@ -from . import ceph_volume +import sys +sys.path.append('./library') +import ceph_volume import mock import os diff --git a/plugins/filter/test_ipaddrs_in_ranges.py b/tests/plugins/filter/test_ipaddrs_in_ranges.py similarity index 95% rename from plugins/filter/test_ipaddrs_in_ranges.py rename to tests/plugins/filter/test_ipaddrs_in_ranges.py index 3fb2135c0..6357d93b7 100644 --- a/plugins/filter/test_ipaddrs_in_ranges.py +++ b/tests/plugins/filter/test_ipaddrs_in_ranges.py @@ -1,4 +1,6 @@ -from . import ipaddrs_in_ranges +import sys +sys.path.append('./plugins/filter') +import ipaddrs_in_ranges filter_plugin = ipaddrs_in_ranges.FilterModule()