Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add import order/style check with isort #3862

Merged
merged 1 commit into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ requirements: pip

check:
./selftests/style.sh
./selftests/isort.sh
inspekt lint --disable W,R,C,E0203,E0601,E1002,E1101,E1102,E1103,E1120,F0401,I0011,E1003,W605,I1101 --exclude avocado-libs,scripts/github
pylint --errors-only --disable=all --enable=spelling --spelling-dict=en_US --spelling-private-dict-file=spell.ignore *

Expand Down
1 change: 1 addition & 0 deletions avocado_vt/discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"""

from virttest.compat import get_opt

from .options import VirtTestOptionsProcess


Expand Down
5 changes: 1 addition & 4 deletions avocado_vt/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@

from avocado.core import output

from virttest import cartesian_config
from virttest import data_dir
from virttest import standalone_test
from virttest import storage
from virttest import cartesian_config, data_dir, standalone_test, storage
from virttest.compat import get_opt, set_opt

from .discovery import DiscoveryMixIn
Expand Down
20 changes: 9 additions & 11 deletions avocado_vt/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,16 @@

from avocado.utils import path as utils_path

from virttest import cartesian_config
from virttest import data_dir
from virttest import defaults
from virttest import standalone_test
from virttest import cartesian_config, data_dir, defaults, standalone_test
from virttest.compat import get_opt, set_opt, set_opt_from_settings
from virttest.standalone_test import SUPPORTED_DISK_BUSES
from virttest.standalone_test import SUPPORTED_IMAGE_TYPES
from virttest.standalone_test import SUPPORTED_LIBVIRT_DRIVERS
from virttest.standalone_test import SUPPORTED_NET_TYPES
from virttest.standalone_test import SUPPORTED_NIC_MODELS
from virttest.standalone_test import SUPPORTED_TEST_TYPES

from virttest.standalone_test import (
SUPPORTED_DISK_BUSES,
SUPPORTED_IMAGE_TYPES,
SUPPORTED_LIBVIRT_DRIVERS,
SUPPORTED_NET_TYPES,
SUPPORTED_NIC_MODELS,
SUPPORTED_TEST_TYPES,
)

LOG = logging.getLogger("avocado.vt.options")

Expand Down
4 changes: 2 additions & 2 deletions avocado_vt/plugins/vt.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
from avocado.utils import path as utils_path

from virttest import data_dir, defaults, standalone_test
from virttest.compat import get_settings_value, add_option
from virttest.compat import add_option, get_settings_value
from virttest.standalone_test import SUPPORTED_LIBVIRT_URIS, SUPPORTED_TEST_TYPES


try:
from avocado.core.loader import loader

from ..loader import VirtTestLoader

AVOCADO_LOADER_AVAILABLE = True
Expand Down
7 changes: 3 additions & 4 deletions avocado_vt/plugins/vt_bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,13 @@
# Copyright: Red Hat Inc. 2015
# Author: Lucas Meneghel Rodrigues <lmr@redhat.com>

import sys
import logging
import sys

from avocado.utils import process
from avocado.core.plugin_interfaces import CLICmd
from avocado.utils import process

from virttest import bootstrap
from virttest import defaults
from virttest import bootstrap, defaults
from virttest.standalone_test import SUPPORTED_TEST_TYPES

LOG = logging.getLogger("avocado.app")
Expand Down
12 changes: 5 additions & 7 deletions avocado_vt/plugins/vt_joblock.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
import errno
import logging
import os
import re
import random
import re
import string
import sys

from avocado.core import exit_codes
from avocado.core.plugin_interfaces import JobPostTests as Post
from avocado.core.plugin_interfaces import JobPreTests as Pre
from avocado.utils.process import pid_exists
from avocado.utils.stacktrace import log_exc_info

from avocado.core.plugin_interfaces import JobPreTests as Pre
from avocado.core.plugin_interfaces import JobPostTests as Post

from ..test import VirtTest
from six.moves import xrange

from virttest.compat import get_settings_value

from six.moves import xrange
from ..test import VirtTest


class LockCreationError(Exception):
Expand Down
7 changes: 4 additions & 3 deletions avocado_vt/plugins/vt_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@

from avocado.core.plugin_interfaces import CLI

from virttest.compat import get_settings_value, add_option
from .vt import add_basic_vt_options, add_qemu_bin_vt_option
from virttest._wrappers import load_source
from virttest.compat import add_option, get_settings_value

from .vt import add_basic_vt_options, add_qemu_bin_vt_option

try:
from avocado.core.loader import loader

from ..loader import VirtTestLoader

AVOCADO_LOADER_AVAILABLE = True
Expand Down Expand Up @@ -70,7 +72,6 @@

from virttest import data_dir # pylint: disable=C0413


_PROVIDERS_DOWNLOAD_DIR = os.path.join(data_dir.get_test_providers_dir(), "downloads")

try:
Expand Down
1 change: 1 addition & 0 deletions avocado_vt/plugins/vt_list_archs.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from avocado.core.plugin_interfaces import CLICmd

from virttest.compat import add_option
from virttest.standalone_test import get_guest_name_parser

Expand Down
1 change: 1 addition & 0 deletions avocado_vt/plugins/vt_list_guests.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from avocado.core.plugin_interfaces import CLICmd
from avocado.core.settings import settings

from virttest.compat import add_option, is_registering_settings_required
from virttest.standalone_test import get_guest_name_parser

Expand Down
4 changes: 2 additions & 2 deletions avocado_vt/plugins/vt_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@
# the 92.0 support will be dropped.
try:
from avocado.core.nrunner import (
RUNNER_RUN_CHECK_INTERVAL,
BaseRunner,
BaseRunnerApp,
RUNNER_RUN_CHECK_INTERVAL,
)
from avocado.core.nrunner import main as nrunner_main
from avocado.core.runners.utils import messages

LTS = True
except ImportError:
from avocado.core.nrunner.app import BaseRunnerApp
from avocado.core.nrunner.runner import BaseRunner, RUNNER_RUN_CHECK_INTERVAL
from avocado.core.nrunner.runner import RUNNER_RUN_CHECK_INTERVAL, BaseRunner
from avocado.core.utils import messages

LTS = False
Expand Down
3 changes: 1 addition & 2 deletions avocado_vt/plugins/vt_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@
"""

import os
from pkg_resources import resource_filename
from pkg_resources import resource_listdir

from avocado.core.plugin_interfaces import Settings
from pkg_resources import resource_filename, resource_listdir


class VTSettings(Settings):
Expand Down
32 changes: 15 additions & 17 deletions avocado_vt/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,25 @@
"""

import os
import sys
import shlex
import sys

from avocado.core import exceptions
from avocado.core import test
from avocado.utils import stacktrace
from avocado.utils import process

from virttest import error_event
from virttest import data_dir
from virttest import env_process
from virttest import funcatexit
from virttest import utils_env
from virttest import utils_params
from virttest import utils_logfile
from virttest import utils_misc
from virttest import version
from virttest._wrappers import load_source
from avocado.core import exceptions, test
from avocado.utils import process, stacktrace

from avocado_vt import utils

from virttest import (
data_dir,
env_process,
error_event,
funcatexit,
utils_env,
utils_logfile,
utils_misc,
utils_params,
version,
)
from virttest._wrappers import load_source

# avocado-vt no longer needs autotest for the majority of its functionality,
# except by:
Expand Down
3 changes: 1 addition & 2 deletions avocado_vt/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
from avocado.core import exceptions
from avocado.utils import genio, stacktrace

from virttest import asset, bootstrap
from virttest import data_dir
from virttest import asset, bootstrap, data_dir
from virttest._wrappers import import_module

BG_ERR_FILE = "background-error.log"
Expand Down
1 change: 0 additions & 1 deletion examples/tests/guest_hostname.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"""
import logging


LOG = logging.getLogger("avocado.vt.examples.guest_hostname")


Expand Down
1 change: 0 additions & 1 deletion examples/tests/hostname.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

from avocado.utils import process


LOG = logging.getLogger("avocado.vt.examples.hostname")


Expand Down
1 change: 0 additions & 1 deletion examples/tests/ls_disk.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"""
import logging


LOG = logging.getLogger("avocado.vt.examples.lsdisk")


Expand Down
6 changes: 2 additions & 4 deletions examples/tests/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,11 @@
import logging
import time

from avocado.utils import process
from avocado.core import exceptions
from avocado.utils import process
from avocado.utils.service import SpecificServiceManager

from virttest import remote
from virttest import error_context

from virttest import error_context, remote

LOG = logging.getLogger("avocado.vt.examples.service")

Expand Down
1 change: 0 additions & 1 deletion examples/tests/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
# $ avocado run template --vt-type qemu to execute it.
import logging


LOG = logging.getLogger("avocado.test")


Expand Down
1 change: 1 addition & 0 deletions requirements-travis.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ aexpect>=1.6.4
netifaces==0.11.0
pyenchant==3.2.2
black==22.3.0
isort==5.10.1
6 changes: 2 additions & 4 deletions scripts/cd_hash.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,14 @@
:copyright: Red Hat 2008-2009
"""

import os
import sys
import logging
import optparse
import os
import sys

from avocado.utils import crypto

from logging_config import LoggingConfig


if __name__ == "__main__":
log_cfg = LoggingConfig(set_fmt=False)
log_cfg.configure_logging()
Expand Down
12 changes: 4 additions & 8 deletions scripts/download_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,20 @@

:copyright: Red Hat 2012
"""
import sys
import os
import logging
import os
import sys

# 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, "virttest")):
sys.path.append(basedir)

from virttest import asset

from avocado.core.output import TERM_SUPPORT

from logging_config import LoggingConfig
from six.moves import input, urllib


from six.moves import input
from six.moves import urllib
from virttest import asset


def download_assets():
Expand Down
5 changes: 2 additions & 3 deletions scripts/github/cache_populate.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
#!/usr/bin/env python

from __future__ import print_function
import sys

import getpass
import sys

from github import Github
from github_issues import GithubIssues

from six.moves import input


gh = Github(
login_or_token=input("Enter github username: "),
password=getpass.getpass("Enter github password: "),
Expand Down
7 changes: 4 additions & 3 deletions scripts/github/example.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
#!/usr/bin/env python

from __future__ import print_function
import sys
import getpass

import datetime
import getpass
import sys

# PyGithub >= 1.13 is required https://pypi.python.org/pypi/PyGithub
from github import Github
from github_issues import GithubIssuesBase, GithubIssues
from github_issues import GithubIssues, GithubIssuesBase

# You could use OAuth here too for unattended access
# see http://developer.github.com/v3/oauth/#create-a-new-authorization
Expand Down
5 changes: 2 additions & 3 deletions scripts/github/github_issues.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@
Classes to cache and read specific items from github issues in a uniform way
"""

from functools import partial as Partial
import datetime
import time
import shelve
import time
from functools import partial as Partial

# Requires PyGithub version >= 1.13 for access to raw_data attribute
import github

from six.moves import xrange


Expand Down
Loading
Loading