提交 d4ec6eba 编写于 作者: L Lukáš Doktor

avocado: Insert the path instead of append

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: NLukáš Doktor <ldoktor@redhat.com>
上级 ba291e4d
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册