From d4ec6eba8b35b9ad4df03b33db010bd4d247bffb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Doktor?= Date: Fri, 31 Jul 2015 12:59:54 +0200 Subject: [PATCH] avocado: Insert the path instead of append MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On multiple places we modify the sys.path to make avocado work from sources. Instead of `append` we should `insert` the path as when running from avocado sources directory, we want to use the modules from here, rather than from installed version. Signed-off-by: Lukáš Doktor --- avocado/core/loader.py | 2 +- selftests/all/doc/doc_build_test.py | 2 +- selftests/all/functional/avocado/argument_parsing_tests.py | 2 +- selftests/all/functional/avocado/basic_tests.py | 2 +- selftests/all/functional/avocado/export_variables_tests.py | 2 +- selftests/all/functional/avocado/gdb_tests.py | 2 +- selftests/all/functional/avocado/job_timeout_tests.py | 2 +- selftests/all/functional/avocado/journal_tests.py | 2 +- selftests/all/functional/avocado/loader_tests.py | 2 +- selftests/all/functional/avocado/multiplex_tests.py | 2 +- selftests/all/functional/avocado/output_check_tests.py | 2 +- selftests/all/functional/avocado/output_tests.py | 2 +- selftests/all/functional/avocado/standalone_tests.py | 2 +- selftests/all/functional/avocado/sysinfo_tests.py | 2 +- selftests/all/functional/avocado/unittest_compat.py | 2 +- selftests/all/functional/avocado/utils_tests.py | 2 +- selftests/all/functional/avocado/wrapper_tests.py | 2 +- selftests/all/unit/avocado/archive_unittest.py | 2 +- selftests/all/unit/avocado/astring_unittest.py | 2 +- selftests/all/unit/avocado/datadir_unittest.py | 2 +- selftests/all/unit/avocado/distro_unittest.py | 2 +- selftests/all/unit/avocado/gdb_unittest.py | 2 +- selftests/all/unit/avocado/jsonresult_unittest.py | 2 +- selftests/all/unit/avocado/loader_unittest.py | 2 +- selftests/all/unit/avocado/plugins_unittest.py | 2 +- selftests/all/unit/avocado/restclient_response_unittest.py | 2 +- selftests/all/unit/avocado/settings_unittest.py | 2 +- selftests/all/unit/avocado/sysinfo_unittest.py | 2 +- selftests/all/unit/avocado/test_unittest.py | 2 +- selftests/all/unit/avocado/utils_linux_modules_unittest.py | 2 +- selftests/all/unit/avocado/utils_output_unittest.py | 2 +- selftests/all/unit/avocado/xunit_unittest.py | 2 +- 32 files changed, 32 insertions(+), 32 deletions(-) diff --git a/avocado/core/loader.py b/avocado/core/loader.py index d190243a..94968838 100644 --- a/avocado/core/loader.py +++ b/avocado/core/loader.py @@ -358,7 +358,7 @@ class FileLoader(TestLoader): test_name = test_path module_name = os.path.basename(test_path).split('.')[0] test_module_dir = os.path.dirname(test_path) - sys.path.append(test_module_dir) + sys.path.insert(0, test_module_dir) stdin, stdout, stderr = sys.stdin, sys.stdout, sys.stderr try: sys.stdin = None diff --git a/selftests/all/doc/doc_build_test.py b/selftests/all/doc/doc_build_test.py index b975c7a9..af9359c3 100644 --- a/selftests/all/doc/doc_build_test.py +++ b/selftests/all/doc/doc_build_test.py @@ -10,7 +10,7 @@ import sys basedir = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', '..', '..') basedir = os.path.abspath(basedir) if os.path.isdir(os.path.join(basedir, 'avocado')): - sys.path.append(basedir) + sys.path.insert(0, basedir) from avocado.utils import process diff --git a/selftests/all/functional/avocado/argument_parsing_tests.py b/selftests/all/functional/avocado/argument_parsing_tests.py index 8ff678f5..564a79d5 100644 --- a/selftests/all/functional/avocado/argument_parsing_tests.py +++ b/selftests/all/functional/avocado/argument_parsing_tests.py @@ -11,7 +11,7 @@ else: basedir = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', '..', '..', '..') basedir = os.path.abspath(basedir) if os.path.isdir(os.path.join(basedir, 'avocado')): - sys.path.append(basedir) + sys.path.insert(0, basedir) from avocado.core import data_dir from avocado.core import job_id diff --git a/selftests/all/functional/avocado/basic_tests.py b/selftests/all/functional/avocado/basic_tests.py index eb1c6718..2f4b66d5 100644 --- a/selftests/all/functional/avocado/basic_tests.py +++ b/selftests/all/functional/avocado/basic_tests.py @@ -15,7 +15,7 @@ else: basedir = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', '..', '..', '..') basedir = os.path.abspath(basedir) if os.path.isdir(os.path.join(basedir, 'avocado')): - sys.path.append(basedir) + sys.path.insert(0, basedir) from avocado.utils import process from avocado.utils import script diff --git a/selftests/all/functional/avocado/export_variables_tests.py b/selftests/all/functional/avocado/export_variables_tests.py index e76ede93..33a22193 100644 --- a/selftests/all/functional/avocado/export_variables_tests.py +++ b/selftests/all/functional/avocado/export_variables_tests.py @@ -8,7 +8,7 @@ import shutil basedir = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', '..', '..', '..') basedir = os.path.abspath(basedir) if os.path.isdir(os.path.join(basedir, 'avocado')): - sys.path.append(basedir) + sys.path.insert(0, basedir) from avocado import VERSION from avocado.utils import process diff --git a/selftests/all/functional/avocado/gdb_tests.py b/selftests/all/functional/avocado/gdb_tests.py index 1f0fa908..89fbc7e0 100644 --- a/selftests/all/functional/avocado/gdb_tests.py +++ b/selftests/all/functional/avocado/gdb_tests.py @@ -8,7 +8,7 @@ import tempfile basedir = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', '..', '..', '..') basedir = os.path.abspath(basedir) if os.path.isdir(os.path.join(basedir, 'avocado')): - sys.path.append(basedir) + sys.path.insert(0, basedir) from avocado.utils import process diff --git a/selftests/all/functional/avocado/job_timeout_tests.py b/selftests/all/functional/avocado/job_timeout_tests.py index fc1e675b..8a983ddf 100644 --- a/selftests/all/functional/avocado/job_timeout_tests.py +++ b/selftests/all/functional/avocado/job_timeout_tests.py @@ -14,7 +14,7 @@ basedir = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', '..', '..', '..') basedir = os.path.abspath(basedir) if os.path.isdir(os.path.join(basedir, 'avocado')): - sys.path.append(basedir) + sys.path.insert(0, basedir) from avocado.utils import process from avocado.utils import script diff --git a/selftests/all/functional/avocado/journal_tests.py b/selftests/all/functional/avocado/journal_tests.py index 7b417a56..37ead7a0 100644 --- a/selftests/all/functional/avocado/journal_tests.py +++ b/selftests/all/functional/avocado/journal_tests.py @@ -10,7 +10,7 @@ import shutil basedir = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', '..', '..', '..') basedir = os.path.abspath(basedir) if os.path.isdir(os.path.join(basedir, 'avocado')): - sys.path.append(basedir) + sys.path.insert(0, basedir) from avocado.utils import process diff --git a/selftests/all/functional/avocado/loader_tests.py b/selftests/all/functional/avocado/loader_tests.py index e7274857..b39e9158 100644 --- a/selftests/all/functional/avocado/loader_tests.py +++ b/selftests/all/functional/avocado/loader_tests.py @@ -12,7 +12,7 @@ else: basedir = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', '..', '..', '..') basedir = os.path.abspath(basedir) if os.path.isdir(os.path.join(basedir, 'avocado')): - sys.path.append(basedir) + sys.path.insert(0, basedir) from avocado.utils import script from avocado.utils import process diff --git a/selftests/all/functional/avocado/multiplex_tests.py b/selftests/all/functional/avocado/multiplex_tests.py index 90ac1c97..511d7f43 100644 --- a/selftests/all/functional/avocado/multiplex_tests.py +++ b/selftests/all/functional/avocado/multiplex_tests.py @@ -15,7 +15,7 @@ basedir = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', '..', '..', '..') basedir = os.path.abspath(basedir) if os.path.isdir(os.path.join(basedir, 'avocado')): - sys.path.append(basedir) + sys.path.insert(0, basedir) from avocado.utils import process diff --git a/selftests/all/functional/avocado/output_check_tests.py b/selftests/all/functional/avocado/output_check_tests.py index 038a51d5..af7a1d4d 100644 --- a/selftests/all/functional/avocado/output_check_tests.py +++ b/selftests/all/functional/avocado/output_check_tests.py @@ -12,7 +12,7 @@ else: basedir = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', '..', '..', '..') basedir = os.path.abspath(basedir) if os.path.isdir(os.path.join(basedir, 'avocado')): - sys.path.append(basedir) + sys.path.insert(0, basedir) from avocado.utils import process from avocado.utils import script diff --git a/selftests/all/functional/avocado/output_tests.py b/selftests/all/functional/avocado/output_tests.py index f4f3fc42..f3563b57 100644 --- a/selftests/all/functional/avocado/output_tests.py +++ b/selftests/all/functional/avocado/output_tests.py @@ -15,7 +15,7 @@ else: basedir = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', '..', '..', '..') basedir = os.path.abspath(basedir) if os.path.isdir(os.path.join(basedir, 'avocado')): - sys.path.append(basedir) + sys.path.insert(0, basedir) from avocado.utils import process from avocado.core.output import TermSupport diff --git a/selftests/all/functional/avocado/standalone_tests.py b/selftests/all/functional/avocado/standalone_tests.py index 23405689..e1eea99d 100644 --- a/selftests/all/functional/avocado/standalone_tests.py +++ b/selftests/all/functional/avocado/standalone_tests.py @@ -10,7 +10,7 @@ else: basedir = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', '..', '..', '..') basedir = os.path.abspath(basedir) if os.path.isdir(os.path.join(basedir, 'avocado')): - sys.path.append(basedir) + sys.path.insert(0, basedir) from avocado.utils import process diff --git a/selftests/all/functional/avocado/sysinfo_tests.py b/selftests/all/functional/avocado/sysinfo_tests.py index c1368fe9..4fc4ecb7 100644 --- a/selftests/all/functional/avocado/sysinfo_tests.py +++ b/selftests/all/functional/avocado/sysinfo_tests.py @@ -12,7 +12,7 @@ else: basedir = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', '..', '..', '..') basedir = os.path.abspath(basedir) if os.path.isdir(os.path.join(basedir, 'avocado')): - sys.path.append(basedir) + sys.path.insert(0, basedir) from avocado.utils import process diff --git a/selftests/all/functional/avocado/unittest_compat.py b/selftests/all/functional/avocado/unittest_compat.py index 13b9d8d3..1f55cc8d 100644 --- a/selftests/all/functional/avocado/unittest_compat.py +++ b/selftests/all/functional/avocado/unittest_compat.py @@ -11,7 +11,7 @@ basedir = os.path.join( os.path.dirname(os.path.abspath(__file__)), '..', '..', '..', '..') basedir = os.path.abspath(basedir) if os.path.isdir(os.path.join(basedir, 'avocado')): - sys.path.append(basedir) + sys.path.insert(0, basedir) from avocado.utils import script from avocado.utils import process diff --git a/selftests/all/functional/avocado/utils_tests.py b/selftests/all/functional/avocado/utils_tests.py index aed13905..6b956930 100644 --- a/selftests/all/functional/avocado/utils_tests.py +++ b/selftests/all/functional/avocado/utils_tests.py @@ -13,7 +13,7 @@ else: basedir = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', '..', '..', '..') basedir = os.path.abspath(basedir) if os.path.isdir(os.path.join(basedir, 'avocado')): - sys.path.append(basedir) + sys.path.insert(0, basedir) from avocado.utils import process diff --git a/selftests/all/functional/avocado/wrapper_tests.py b/selftests/all/functional/avocado/wrapper_tests.py index 3c647fe0..7e7cd703 100644 --- a/selftests/all/functional/avocado/wrapper_tests.py +++ b/selftests/all/functional/avocado/wrapper_tests.py @@ -9,7 +9,7 @@ basedir = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', '..', '..', '..') basedir = os.path.abspath(basedir) if os.path.isdir(os.path.join(basedir, 'avocado')): - sys.path.append(basedir) + sys.path.insert(0, basedir) from avocado.utils import process from avocado.utils import script diff --git a/selftests/all/unit/avocado/archive_unittest.py b/selftests/all/unit/avocado/archive_unittest.py index 11c0d9fd..d447141c 100644 --- a/selftests/all/unit/avocado/archive_unittest.py +++ b/selftests/all/unit/avocado/archive_unittest.py @@ -9,7 +9,7 @@ import random basedir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) basedir = os.path.dirname(basedir) if os.path.isdir(os.path.join(basedir, 'avocado')): - sys.path.append(basedir) + sys.path.insert(0, basedir) from avocado.utils import archive from avocado.utils import crypto diff --git a/selftests/all/unit/avocado/astring_unittest.py b/selftests/all/unit/avocado/astring_unittest.py index ac22187c..9928a395 100644 --- a/selftests/all/unit/avocado/astring_unittest.py +++ b/selftests/all/unit/avocado/astring_unittest.py @@ -6,7 +6,7 @@ import sys basedir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) basedir = os.path.dirname(basedir) if os.path.isdir(os.path.join(basedir, 'avocado')): - sys.path.append(basedir) + sys.path.insert(0, basedir) from avocado.utils import astring diff --git a/selftests/all/unit/avocado/datadir_unittest.py b/selftests/all/unit/avocado/datadir_unittest.py index 0497b924..13503c3f 100644 --- a/selftests/all/unit/avocado/datadir_unittest.py +++ b/selftests/all/unit/avocado/datadir_unittest.py @@ -11,7 +11,7 @@ from flexmock import flexmock basedir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) basedir = os.path.dirname(basedir) if os.path.isdir(os.path.join(basedir, 'avocado')): - sys.path.append(basedir) + sys.path.insert(0, basedir) from avocado.core import settings diff --git a/selftests/all/unit/avocado/distro_unittest.py b/selftests/all/unit/avocado/distro_unittest.py index e777f7ce..dfd6a985 100644 --- a/selftests/all/unit/avocado/distro_unittest.py +++ b/selftests/all/unit/avocado/distro_unittest.py @@ -10,7 +10,7 @@ from flexmock import flexmock basedir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) basedir = os.path.dirname(basedir) if os.path.isdir(os.path.join(basedir, 'avocado')): - sys.path.append(basedir) + sys.path.insert(0, basedir) from avocado.utils import distro diff --git a/selftests/all/unit/avocado/gdb_unittest.py b/selftests/all/unit/avocado/gdb_unittest.py index 892c958b..30a8c6e6 100644 --- a/selftests/all/unit/avocado/gdb_unittest.py +++ b/selftests/all/unit/avocado/gdb_unittest.py @@ -6,7 +6,7 @@ import unittest basedir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) basedir = os.path.dirname(basedir) if os.path.isdir(os.path.join(basedir, 'avocado')): - sys.path.append(basedir) + sys.path.insert(0, basedir) from avocado.utils import gdb diff --git a/selftests/all/unit/avocado/jsonresult_unittest.py b/selftests/all/unit/avocado/jsonresult_unittest.py index b3458807..6b11182a 100644 --- a/selftests/all/unit/avocado/jsonresult_unittest.py +++ b/selftests/all/unit/avocado/jsonresult_unittest.py @@ -10,7 +10,7 @@ import shutil basedir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) basedir = os.path.dirname(basedir) if os.path.isdir(os.path.join(basedir, 'avocado')): - sys.path.append(basedir) + sys.path.insert(0, basedir) from avocado import Test from avocado.core.plugins import jsonresult diff --git a/selftests/all/unit/avocado/loader_unittest.py b/selftests/all/unit/avocado/loader_unittest.py index 01431678..c9a6246d 100644 --- a/selftests/all/unit/avocado/loader_unittest.py +++ b/selftests/all/unit/avocado/loader_unittest.py @@ -10,7 +10,7 @@ basedir = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', '..', '..', '..') basedir = os.path.abspath(basedir) if os.path.isdir(os.path.join(basedir, 'avocado')): - sys.path.append(basedir) + sys.path.insert(0, basedir) from avocado.core import test from avocado.core import exceptions diff --git a/selftests/all/unit/avocado/plugins_unittest.py b/selftests/all/unit/avocado/plugins_unittest.py index 3bf53c7a..adbbb125 100644 --- a/selftests/all/unit/avocado/plugins_unittest.py +++ b/selftests/all/unit/avocado/plugins_unittest.py @@ -6,7 +6,7 @@ import unittest basedir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) basedir = os.path.dirname(basedir) if os.path.isdir(os.path.join(basedir, 'avocado')): - sys.path.append(basedir) + sys.path.insert(0, basedir) from avocado.core.plugins import plugin diff --git a/selftests/all/unit/avocado/restclient_response_unittest.py b/selftests/all/unit/avocado/restclient_response_unittest.py index 28599983..a59ab216 100644 --- a/selftests/all/unit/avocado/restclient_response_unittest.py +++ b/selftests/all/unit/avocado/restclient_response_unittest.py @@ -6,7 +6,7 @@ import unittest basedir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) basedir = os.path.dirname(basedir) if os.path.isdir(os.path.join(basedir, 'avocado')): - sys.path.append(basedir) + sys.path.insert(0, basedir) from avocado.core.restclient import response diff --git a/selftests/all/unit/avocado/settings_unittest.py b/selftests/all/unit/avocado/settings_unittest.py index a9895575..9f1b76e8 100644 --- a/selftests/all/unit/avocado/settings_unittest.py +++ b/selftests/all/unit/avocado/settings_unittest.py @@ -11,7 +11,7 @@ else: basedir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) basedir = os.path.dirname(basedir) if os.path.isdir(os.path.join(basedir, 'avocado')): - sys.path.append(basedir) + sys.path.insert(0, basedir) from avocado.core import settings diff --git a/selftests/all/unit/avocado/sysinfo_unittest.py b/selftests/all/unit/avocado/sysinfo_unittest.py index 4367a294..c6e44abb 100644 --- a/selftests/all/unit/avocado/sysinfo_unittest.py +++ b/selftests/all/unit/avocado/sysinfo_unittest.py @@ -12,7 +12,7 @@ else: basedir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) basedir = os.path.dirname(basedir) if os.path.isdir(os.path.join(basedir, 'avocado')): - sys.path.append(basedir) + sys.path.insert(0, basedir) from avocado.core import sysinfo diff --git a/selftests/all/unit/avocado/test_unittest.py b/selftests/all/unit/avocado/test_unittest.py index 3c9b1a34..97f88fb7 100644 --- a/selftests/all/unit/avocado/test_unittest.py +++ b/selftests/all/unit/avocado/test_unittest.py @@ -12,7 +12,7 @@ else: basedir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) basedir = os.path.dirname(basedir) if os.path.isdir(os.path.join(basedir, 'avocado')): - sys.path.append(basedir) + sys.path.insert(0, basedir) from avocado.core import test from avocado.utils import script diff --git a/selftests/all/unit/avocado/utils_linux_modules_unittest.py b/selftests/all/unit/avocado/utils_linux_modules_unittest.py index c4f4e1ed..cfb95f2d 100644 --- a/selftests/all/unit/avocado/utils_linux_modules_unittest.py +++ b/selftests/all/unit/avocado/utils_linux_modules_unittest.py @@ -6,7 +6,7 @@ import sys basedir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) basedir = os.path.dirname(basedir) if os.path.isdir(os.path.join(basedir, 'avocado')): - sys.path.append(basedir) + sys.path.insert(0, basedir) from avocado.utils import linux_modules diff --git a/selftests/all/unit/avocado/utils_output_unittest.py b/selftests/all/unit/avocado/utils_output_unittest.py index 573fb0da..68f903fe 100644 --- a/selftests/all/unit/avocado/utils_output_unittest.py +++ b/selftests/all/unit/avocado/utils_output_unittest.py @@ -6,7 +6,7 @@ import sys basedir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) basedir = os.path.dirname(basedir) if os.path.isdir(os.path.join(basedir, 'avocado')): - sys.path.append(basedir) + sys.path.insert(0, basedir) from avocado.utils import output diff --git a/selftests/all/unit/avocado/xunit_unittest.py b/selftests/all/unit/avocado/xunit_unittest.py index 764ae070..595bc3ff 100644 --- a/selftests/all/unit/avocado/xunit_unittest.py +++ b/selftests/all/unit/avocado/xunit_unittest.py @@ -10,7 +10,7 @@ import shutil basedir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) basedir = os.path.dirname(basedir) if os.path.isdir(os.path.join(basedir, 'avocado')): - sys.path.append(basedir) + sys.path.insert(0, basedir) from avocado import Test from avocado.core.plugins import xunit -- GitLab