Skip to content

Commit

Permalink
Add isort pre-commit hook (#75)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmitrii Chernukhin authored Nov 10, 2021
1 parent b6334bb commit b7ba387
Show file tree
Hide file tree
Showing 12 changed files with 40 additions and 30 deletions.
1 change: 1 addition & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[flake8]
max-line-length = 120
ignore = E203

28 changes: 16 additions & 12 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
repos:
- repo: https://github.com/pycqa/isort
rev: 5.9.3
hooks:
- id: isort
- repo: https://github.com/psf/black
rev: '21.5b1'
hooks:
Expand All @@ -7,15 +11,15 @@ repos:
- repo: https://github.com/pre-commit/mirrors-pylint
rev: 'v3.0.0a3'
hooks:
- id: pylint
additional_dependencies:
- pytest
- docker
- adcm_client>=2021.4.15.17
- allure-pytest>=2.9.42
- requests
- version_utils
- ifaddr
- retry
- deprecated
- coreapi
- id: pylint
additional_dependencies:
- pytest
- docker
- adcm_client>=2021.4.15.17
- allure-pytest>=2.9.42
- requests
- version_utils
- ifaddr
- retry
- deprecated
- coreapi
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,7 @@ max-module-lines = 1000
[tool.pylint.similarities]
ignore-imports = true
min-similarity-lines = 5

[tool.isort]
profile = "black"
line_length = 120
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
packages=find_packages(where="src"),
package_dir={"": "src"},
include_package_data=True,
version="4.11.0",
version="4.11.1",
# the following makes a plugin available to pytest
entry_points={"pytest11": ["adcm_pytest_plugin = adcm_pytest_plugin.plugin"]},
# custom PyPI classifier for pytest plugins
Expand Down
3 changes: 2 additions & 1 deletion src/adcm_pytest_plugin/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
# limitations under the License.
"""Common methods and classes"""

import pytest
import allure
import pytest

from .utils import get_data_dir


Expand Down
6 changes: 3 additions & 3 deletions src/adcm_pytest_plugin/docker_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
import socket
import string
import tarfile
from tempfile import TemporaryDirectory
import warnings
from contextlib import contextmanager, suppress
from dataclasses import asdict, dataclass
from gzip import compress
from typing import Optional, Tuple, Generator
from tempfile import TemporaryDirectory
from typing import Generator, Optional, Tuple

import allure
import docker
Expand All @@ -39,8 +39,8 @@
from docker.utils import parse_repository_tag
from retry.api import retry_call

from .utils import random_string
from .common import add_dummy_objects_to_adcm
from .utils import random_string

MIN_DOCKER_PORT = 8000
MAX_DOCKER_PORT = 9000
Expand Down
3 changes: 2 additions & 1 deletion src/adcm_pytest_plugin/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
from requests.exceptions import ReadTimeout as DockerReadTimeout

from adcm_pytest_plugin import utils

from .docker_utils import (
ADCM,
ADCMInitializer,
Expand All @@ -37,7 +38,7 @@
remove_container_volumes,
remove_docker_image,
)
from .utils import check_mutually_exclusive, allure_reporter
from .utils import allure_reporter, check_mutually_exclusive

DATADIR = utils.get_data_dir(__file__)

Expand Down
6 changes: 3 additions & 3 deletions src/adcm_pytest_plugin/objects/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
"""Class definitions for actions related objects"""
import json
import os
from dataclasses import dataclass, asdict, fields
from typing import List
from collections import defaultdict
from dataclasses import asdict, dataclass, fields
from typing import List

from adcm_client.objects import Action, Prototype, Bundle
from adcm_client.objects import Action, Bundle, Prototype


@dataclass
Expand Down
4 changes: 2 additions & 2 deletions src/adcm_pytest_plugin/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import pathlib
import shutil
from argparse import Namespace
from typing import List, Iterator
from typing import Iterator, List

import pytest
import requests
Expand All @@ -28,7 +28,7 @@
from .fixtures import * # noqa: F401, F403
from .objects.actions import ActionRunInfo, ActionsRunReport, ActionsSpec
from .params import * # noqa: F401, F403
from .utils import func_name_to_title, allure_reporter
from .utils import allure_reporter, func_name_to_title

options: Namespace = Namespace()
_PHASE_RESULT_VAR_NAME_TEMPLATE = "rep_{phase}_passed"
Expand Down
10 changes: 5 additions & 5 deletions src/adcm_pytest_plugin/steps/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@
from contextlib import contextmanager
from difflib import get_close_matches
from typing import Union
from coreapi.exceptions import ErrorMessage

import allure
import pytest
from version_utils import rpm
from adcm_client.base import ObjectNotFound
from adcm_client.objects import Cluster, Service, Host, Task, Component, Provider, Action
from adcm_client.objects import Action, Cluster, Component, Host, Provider, Service, Task
from coreapi.exceptions import ErrorMessage
from version_utils import rpm

from adcm_pytest_plugin.steps.asserts import assert_action_result
from adcm_pytest_plugin.exceptions.adcm import ADCMError
from adcm_pytest_plugin.plugin import options
from adcm_pytest_plugin.objects.actions import ActionRunInfo, ActionsSpec
from adcm_pytest_plugin.plugin import options
from adcm_pytest_plugin.steps.asserts import assert_action_result


def _get_error_text_from_task_logs(task: Task):
Expand Down
1 change: 0 additions & 1 deletion src/adcm_pytest_plugin/steps/asserts.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"""

import allure

from adcm_client.objects import BaseAPIObject

from adcm_pytest_plugin.exceptions.bundles import BundleError
Expand Down
2 changes: 1 addition & 1 deletion src/adcm_pytest_plugin/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from contextlib import AbstractContextManager
from inspect import getfullargspec
from time import sleep, time
from typing import Callable, Iterable, List, Tuple, Type, Union, Optional
from typing import Callable, Iterable, List, Optional, Tuple, Type, Union

import allure
import pytest
Expand Down

0 comments on commit b7ba387

Please sign in to comment.