diff --git a/Makefile b/Makefile index 0bb3b0d1bfd89c443da2d3b5db1bb1c5fcdae591..9a0b66e2468edf635289de72f82928c6ee3c95b2 100644 --- a/Makefile +++ b/Makefile @@ -128,22 +128,19 @@ requirements-plugins: requirements smokecheck: clean develop ./scripts/avocado run passtest.py -check: clean develop check_cyclical modules_boundaries +check: clean develop modules_boundaries # Unless manually set, this is equivalent to AVOCADO_CHECK_LEVEL=0 selftests/checkall selftests/check_tmp_dirs -check-full: clean develop check_cyclical modules_boundaries +check-full: clean develop modules_boundaries AVOCADO_CHECK_LEVEL=2 selftests/checkall selftests/check_tmp_dirs -selfcheck: clean check_cyclical modules_boundaries develop +selfcheck: clean modules_boundaries develop AVOCADO_SELF_CHECK=1 selftests/checkall selftests/check_tmp_dirs -check_cyclical: - selftests/cyclical_deps avocado - modules_boundaries: selftests/modules_boundaries diff --git a/requirements-selftests.txt b/requirements-selftests.txt index 651f5643fac44ee2241007e87343bd10689eac7f..12318ac89a8c46431b3896a37142397b856291f7 100644 --- a/requirements-selftests.txt +++ b/requirements-selftests.txt @@ -14,10 +14,6 @@ funcsigs>=0.4 # To run make check pep8>=1.6.2 Pillow>=2.2.1 -snakefood>=1.4; python_version <= '2.7' -networkx>=1.9.1; python_version <= '2.7' -pygraphviz>=1.3rc2; python_version <= '2.7' -pydot>=1.2.3; python_version <= '2.7' aexpect>=1.0.0 psutil>=3.1.1 # six is a stevedore depedency, but we also use it directly diff --git a/requirements-travis.txt b/requirements-travis.txt index cca07f976643825299d5a495185cf4d35a09abbc..e735df10e2a392007fc2c2b0bffa1f445dc548e4 100644 --- a/requirements-travis.txt +++ b/requirements-travis.txt @@ -9,9 +9,6 @@ pep8==1.6.2 requests==1.2.3 PyYAML==3.11 Pillow==2.8.1 -snakefood==1.4; python_version <= '2.7' -networkx==1.9.1; python_version <= '2.7' -pygraphviz==1.3rc2; python_version <= '2.7' mock==1.2.0; python_version <= '2.7' aexpect==1.4.0 psutil==3.1.1 diff --git a/selftests/checkall b/selftests/checkall index 4b2f50e70ea72bb583ca27789f37e9b0d1d65df4..06c272dcf453200e97c9b594382c06d9186bb126 100755 --- a/selftests/checkall +++ b/selftests/checkall @@ -167,7 +167,7 @@ results_dir_content() { } [ "$SKIP_RESULTSDIR_CHECK" ] || RESULTS_DIR_CONTENT="$(ls $RESULTS_DIR 2> /dev/null)" -run_rc lint 'inspekt lint --exclude=.git --enable W0101,W0102,W0404,W0611,W0612,W0622' +run_rc lint 'inspekt lint --exclude=.git --enable R0401,W0101,W0102,W0404,W0611,W0612,W0622' # Skip checking test_utils_cpu.py due to inspektor bug run_rc indent 'inspekt indent --exclude=.git,selftests/unit/test_utils_cpu.py' run_rc style 'inspekt style --exclude=.git --disable E501,E265,W601,E402,E722' diff --git a/selftests/cyclical_deps b/selftests/cyclical_deps deleted file mode 100755 index 0525f2a0f9d6aee1166fc5a42322d9c6c48c629c..0000000000000000000000000000000000000000 --- a/selftests/cyclical_deps +++ /dev/null @@ -1,91 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -from __future__ import print_function - -""" -Simple script to test cyclical dependencies in modules. - -Requirements: - - SnakeFood (pip install snakefood) - - NetworkX (yum/apt-get install python-networkx) -""" - -__author__ = 'Ruda Moura ' - -import os -import sys -import subprocess -import tempfile - -# it doesn't make sense to go any further on Python 3 because snakefood -# won't be available anyway. it's not fair to say this check failed, so -# let's exit successfully. the check should be performend when running -# on Python 2. -if sys.version_info[0] == 3: - sys.exit(0) - - -try: - import networkx as nx -except ImportError: - print("NetworkX is not installed and is required!", file=sys.stderr) - print("Please, install 'python-networkx' with yum or apt.", file=sys.stderr) - sys.exit(2) - -# simple magic for using scripts within a source tree -basedir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) -if os.path.isdir(os.path.join(basedir, 'avocado')): - os.environ['PATH'] += ":" + os.path.join(basedir, 'scripts') - os.environ['PATH'] += ":" + os.path.join(basedir, 'libexec') - sys.path.append(basedir) - -from avocado.utils import process - - -def has_snakefood(): - with open(os.devnull, 'w') as null: - try: - cmd = ['sfood', '-h'] - subprocess.call(cmd, stdout=null) - except Exception as detail: - print("Could not find sfood utility: %s: %s" % (cmd, detail), file=sys.stderr) - print("Did you forget to 'pip install snakefood'?", file=sys.stderr) - return False - return True - - -def generate_dot_file(path): - cmdline = 'sfood --internal %s | sfood-graph --remove-extensions' - output = process.system_output(cmdline % path, shell=True) - tmp = tempfile.mktemp() - with open(tmp, 'w') as sfood_file: - sfood_file.write(output) - return tmp - - -def cyclical_deps(path_dot): - graph = nx.DiGraph(nx.nx_agraph.read_dot(path_dot)) - - cycles = list(nx.simple_cycles(graph)) - if cycles: - print('Found cyclical dependencies in module(s):') - for cycle in cycles: - print('*', ' <=> '.join(cycle)) - return True - else: - print('No cyclical dependencies found') - print('OK') - return False - - -if __name__ == '__main__': - if sys.argv[1:] and has_snakefood(): - dot = generate_dot_file(sys.argv[1]) - has_cycles = cyclical_deps(dot) - os.remove(dot) - if has_cycles: - sys.exit(1) - else: - sys.exit(2) - sys.exit(0)