提交 79b60651 编写于 作者: L Lucas Meneghel Rodrigues

Merge pull request #666 from clebergnu/api_review_4th_round

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