提交 d886d083 编写于 作者: C Cleber Rosa

API review: implement relative imports also on avocado.core.*

The same approach has already been applied to avocado.utils itself
and it's documented at:

https://www.python.org/dev/peps/pep-0328/Signed-off-by: NCleber Rosa <crosa@redhat.com>
上级 dbb90ad3
......@@ -277,12 +277,12 @@ try:
except ImportError:
import subprocess
from avocado.utils import astring
from avocado.utils import data_factory
from avocado.utils import process
from avocado.utils import genio
from avocado.utils import wait
from avocado.utils import path as utils_path
from ..utils import astring
from ..utils import data_factory
from ..utils import process
from ..utils import genio
from ..utils import wait
from ..utils import path as utils_path
class ExpectError(Exception):
......
......@@ -18,9 +18,9 @@ The core Avocado application.
import os
from avocado.core.log import configure
from avocado.core.parser import Parser
from avocado.core.plugins.manager import get_plugin_manager
from .log import configure
from .parser import Parser
from .plugins.manager import get_plugin_manager
class AvocadoApp(object):
......
......@@ -33,10 +33,10 @@ import shutil
import time
import tempfile
from avocado.core import job_id
from avocado.core.settings import settings
from avocado.utils import path as utils_path
from avocado.utils.data_structures import Borg
from . import job_id
from .settings import settings
from ..utils import path as utils_path
from ..utils.data_structures import Borg
_BASE_DIR = os.path.join(sys.modules[__name__].__file__, "..", "..", "..")
......
......@@ -27,26 +27,26 @@ import shutil
import fnmatch
from avocado import runtime
from avocado.core import data_dir
from avocado.core import runner
from avocado.core import loader
from avocado.core import sysinfo
from avocado.core import result
from avocado.core import exit_codes
from avocado.core import exceptions
from avocado.core import job_id
from avocado.core import output
from avocado.core import multiplexer
from avocado.core.settings import settings
from avocado.core.plugins import jsonresult
from avocado.core.plugins import xunit
from avocado.core.plugins.builtin import ErrorsLoading
from avocado.utils import archive
from avocado.utils import path
from . import data_dir
from . import runner
from . import loader
from . import sysinfo
from . import result
from . import exit_codes
from . import exceptions
from . import job_id
from . import output
from . import multiplexer
from .settings import settings
from .plugins import jsonresult
from .plugins import xunit
from .plugins.builtin import ErrorsLoading
from ..utils import archive
from ..utils import path
try:
from avocado.core.plugins import htmlresult
from .plugins import htmlresult
HTML_REPORT_SUPPORT = True
except ImportError:
HTML_REPORT_SUPPORT = False
......
......@@ -23,10 +23,10 @@ import os
import re
import sys
from avocado.core import data_dir
from avocado.core import test
from avocado.utils import path
from avocado.core import output
from . import data_dir
from . import test
from . import output
from ..utils import path
try:
import cStringIO as StringIO
......
......@@ -24,7 +24,7 @@ import itertools
import logging
import re
from avocado.core import tree
from . import tree
MULTIPLEX_CAPABLE = tree.MULTIPLEX_CAPABLE
......
......@@ -19,8 +19,8 @@ import logging
import os
import sys
from avocado.utils import path as utils_path
from avocado.core.settings import settings
from .settings import settings
from ..utils import path as utils_path
class FilterError(logging.Filter):
......
......@@ -20,8 +20,8 @@ Avocado application command line parsing.
import sys
import argparse
from avocado.core import tree
from avocado.core import settings
from . import tree
from . import settings
from avocado.version import VERSION
PROG = 'avocado'
......
......@@ -18,8 +18,8 @@ import os
import logging
from importlib import import_module
from avocado.core.plugins.plugin import Plugin
from avocado.core.settings import settings
from .plugin import Plugin
from ..settings import settings
log = logging.getLogger("avocado.app")
......
......@@ -12,10 +12,10 @@
# Copyright: Red Hat Inc. 2013-2014
# Author: Lucas Meneghel Rodrigues <lmr@redhat.com>
from avocado.core import output
from avocado.core import data_dir
from avocado.core.settings import settings
from avocado.core.plugins import plugin
from . import plugin
from .. import output
from .. import data_dir
from ..settings import settings
class ConfigOptions(plugin.Plugin):
......
......@@ -17,12 +17,12 @@ import bz2
import sys
import json
from avocado.core import output
from avocado.core import exit_codes
from avocado.core.plugins import plugin
from avocado.utils import process
from avocado.utils import path as utils_path
from avocado.utils import distro as utils_distro
from . import plugin
from .. import output
from .. import exit_codes
from ...utils import process
from ...utils import path as utils_path
from ...utils import distro as utils_distro
class SoftwarePackage(object):
......
......@@ -17,8 +17,8 @@ Libexec PATHs modifier
import os
import sys
from avocado.core import exit_codes, output
from avocado.core.plugins import plugin
from . import plugin
from .. import exit_codes, output
class ExecPath(plugin.Plugin):
......
......@@ -15,9 +15,9 @@
"""Run tests with GDB goodies enabled."""
from avocado import runtime
from avocado.utils import path as utils_path
from avocado.core.plugins import plugin
from avocado.core.settings import settings
from . import plugin
from ..settings import settings
from ...utils import path as utils_path
class GDB(plugin.Plugin):
......
......@@ -23,11 +23,11 @@ import subprocess
import pystache
from avocado import runtime
from avocado.core import exit_codes
from avocado.core import output
from avocado.core.result import TestResult
from avocado.utils import path as utils_path
from avocado.core.plugins import plugin
from . import plugin
from .. import exit_codes
from .. import output
from ..result import TestResult
from ...utils import path as utils_path
class ReportModel(object):
......
......@@ -18,8 +18,8 @@ import os
import sqlite3
import datetime
from avocado.core.plugins import plugin
from avocado.core.result import TestResult
from . import plugin
from ..result import TestResult
JOURNAL_FILENAME = ".journal.sqlite"
......
......@@ -18,9 +18,9 @@ JSON output module.
import json
from avocado.core import output
from avocado.core.result import TestResult
from avocado.core.plugins import plugin
from . import plugin
from .. import output
from ..result import TestResult
class JSONTestResult(TestResult):
......
......@@ -16,8 +16,8 @@
import logging
from avocado.core.plugins.builtin import load_builtins
from avocado.core.plugins.plugin import Plugin
from .builtin import load_builtins
from .plugin import Plugin
DefaultPluginManager = None
......
......@@ -14,11 +14,11 @@
import sys
from avocado.core.plugins import plugin
from avocado.core import output
from avocado.core import exit_codes
from avocado.core import tree
from avocado.core import multiplexer
from . import plugin
from .. import output
from .. import exit_codes
from .. import tree
from .. import multiplexer
class Multiplexer(plugin.Plugin):
......
......@@ -12,10 +12,10 @@
# Copyright: Red Hat Inc. 2013-2014
# Author: Ruda Moura <rmoura@redhat.com>
from avocado.core import output
from avocado.core.plugins import plugin
from avocado.core.plugins.builtin import ErrorsLoading
from avocado.core.plugins.manager import get_plugin_manager
from . import plugin
from .builtin import ErrorsLoading
from .manager import get_plugin_manager
from .. import output
class PluginList(plugin.Plugin):
......
......@@ -16,10 +16,10 @@
import getpass
from avocado.core.plugins import plugin
from avocado.core.remote import RemoteTestResult
from avocado.core.remote import RemoteTestRunner
from avocado.utils import remote
from . import plugin
from ..remote import RemoteTestResult
from ..remote import RemoteTestRunner
from ...utils import remote
class RunRemote(plugin.Plugin):
......@@ -78,7 +78,7 @@ class RunRemote(plugin.Plugin):
if not getattr(app_args, arg):
missing.append(arg)
if missing:
from avocado.core import output, exit_codes
from .. import output, exit_codes
import sys
view = output.View(app_args=app_args)
e_msg = ('Use of %s requires %s arguments to be set. Please set %s'
......
......@@ -18,12 +18,12 @@ Base Test Runner Plugins.
import sys
from avocado.core.settings import settings
from avocado.core import exit_codes
from avocado.core.plugins import plugin
from avocado.core import output
from avocado.core import job
from avocado.core import multiplexer
from . import plugin
from .. import exit_codes
from .. import output
from .. import job
from .. import multiplexer
from ..settings import settings
class TestRunner(plugin.Plugin):
......
......@@ -15,8 +15,8 @@
System information plugin
"""
from avocado.core import sysinfo
from avocado.core.plugins import plugin
from . import plugin
from .. import sysinfo
class SystemInformation(plugin.Plugin):
......
......@@ -14,12 +14,12 @@
import sys
from avocado.core import test
from avocado.core import loader
from avocado.core import output
from avocado.core import exit_codes
from avocado.utils import astring
from avocado.core.plugins import plugin
from . import plugin
from .. import test
from .. import loader
from .. import output
from .. import exit_codes
from ...utils import astring
class TestLister(object):
......
......@@ -16,10 +16,10 @@
import getpass
from avocado.core.plugins import plugin
from avocado.core.remote import VMTestResult
from avocado.core.remote import RemoteTestRunner
from avocado.utils import virt
from . import plugin
from ..remote import VMTestResult
from ..remote import RemoteTestRunner
from ...utils import virt
class RunVM(plugin.Plugin):
......@@ -83,7 +83,7 @@ class RunVM(plugin.Plugin):
if not getattr(app_args, arg):
missing.append(arg)
if missing:
from avocado.core import output, exit_codes
from .. import output, exit_codes
import sys
view = output.View(app_args=app_args)
e_msg = ('Use of %s requires %s arguments to be set. Please set %s'
......
......@@ -15,10 +15,10 @@
import os
import sys
from . import plugin
from .. import exit_codes
from .. import output
from avocado import runtime
from avocado.core import exit_codes
from avocado.core import output
from avocado.core.plugins import plugin
class Wrapper(plugin.Plugin):
......
......@@ -17,9 +17,9 @@
import datetime
from xml.sax.saxutils import quoteattr
from avocado.core import output
from avocado.core.result import TestResult
from avocado.core.plugins import plugin
from . import plugin
from .. import output
from ..result import TestResult
# We use a subset of the XML format defined in this URL:
......
......@@ -12,6 +12,6 @@
# Copyright: Red Hat Inc. 2014-2015
# Author: Ruda Moura <rmoura@redhat.com>
from avocado.core.remote.test import RemoteTest
from avocado.core.remote.result import RemoteTestResult, VMTestResult
from avocado.core.remote.runner import RemoteTestRunner
from .test import RemoteTest
from .result import RemoteTestResult, VMTestResult
from .runner import RemoteTestRunner
......@@ -16,11 +16,11 @@
import os
from avocado.core import data_dir
from avocado.core import exceptions
from avocado.core.result import HumanTestResult
from avocado.utils import remote
from avocado.utils import virt
from .. import data_dir
from .. import exceptions
from ..result import HumanTestResult
from ...utils import remote
from ...utils import virt
class RemoteTestResult(HumanTestResult):
......
......@@ -18,12 +18,12 @@ import json
import os
import re
from avocado.core import exceptions
from avocado.core import status
from avocado.core.runner import TestRunner
from avocado.core.remote.test import RemoteTest
from avocado.utils import archive
from avocado.utils import stacktrace
from .test import RemoteTest
from .. import exceptions
from .. import status
from ..runner import TestRunner
from ...utils import archive
from ...utils import stacktrace
from fabric.exceptions import CommandTimeout
......
......@@ -6,8 +6,8 @@ Module that implements the actions for the CLI App when the job toplevel
command is used
"""
from avocado.core.restclient import connection
from avocado.core.restclient.cli.actions import base
from . import base
from ... import connection
@base.action
......
......@@ -22,11 +22,12 @@ import types
import importlib
import functools
from avocado.core import settings
from avocado.core import output
from avocado.core import exit_codes
from avocado.core.restclient import connection
from avocado.core.restclient.cli import parser
from . import parser
from .. import connection
from ... import settings
from ... import output
from ... import exit_codes
__all__ = ['App']
......
......@@ -16,7 +16,7 @@
This module has actions for the server command
"""
from avocado.core.restclient.cli.args import base
from . import base
__all__ = ['ACTION_STATUS', 'ACTION_ARGUMENTS', 'ARGUMENTS']
......
......@@ -21,7 +21,7 @@ basic object that allows methods to be called on the remote server.
import requests
from avocado.core.settings import settings
from ..settings import settings
__all__ = ['get_default', 'Connection']
......
......@@ -26,13 +26,13 @@ import sys
import time
from avocado import runtime
from avocado.core import test
from avocado.core import exceptions
from avocado.core import output
from avocado.core import status
from avocado.core import exit_codes
from avocado.utils import wait
from avocado.utils import stacktrace
from . import test
from . import exceptions
from . import output
from . import status
from . import exit_codes
from ..utils import wait
from ..utils import stacktrace
class TestRunner(object):
......
......@@ -21,7 +21,7 @@ import os
import sys
import glob
from avocado.utils import path
from ..utils import path
if 'VIRTUAL_ENV' in os.environ:
......
......@@ -23,12 +23,12 @@ try:
except ImportError:
import subprocess
from avocado.utils import genio
from avocado.utils import process
from avocado.utils import software_manager
from avocado.utils import path as utils_path
from avocado.core import output
from avocado.core.settings import settings
from . import output
from .settings import settings
from ..utils import genio
from ..utils import process
from ..utils import software_manager
from ..utils import path as utils_path
log = logging.getLogger("avocado.sysinfo")
......
......@@ -31,14 +31,14 @@ if sys.version_info[:2] == (2, 6):
else:
import unittest
from avocado.core import data_dir
from avocado.core import sysinfo
from avocado.core import exceptions
from avocado.core import multiplexer
from avocado.utils import genio
from avocado.utils import path as utils_path
from avocado.utils import process
from avocado.utils import stacktrace
from . import data_dir
from . import sysinfo
from . import exceptions
from . import multiplexer
from ..utils import genio
from ..utils import path as utils_path
from ..utils import process
from ..utils import stacktrace
from avocado.version import VERSION
......
......@@ -49,7 +49,7 @@ else:
except ImportError:
from yaml import Loader
from avocado.core import output
from . import output
# Mapping for yaml flags
YAML_INCLUDE = 0
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册