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

Bump pre-commit checks #3023

Merged
merged 1 commit into from
Jun 20, 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
16 changes: 8 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https:/hhatto/autopep8
rev: 'v2.1.0'
rev: 'v2.3.0'
hooks:
- id: autopep8

Expand All @@ -21,7 +21,7 @@ repos:
- id: trailing-whitespace

- repo: https:/pre-commit/mirrors-mypy
rev: "v1.9.0"
rev: "v1.10.0"
hooks:
- id: mypy
language_version: "3.9"
Expand Down Expand Up @@ -66,7 +66,7 @@ repos:
args: [--config-file=pyproject.toml]

- repo: https:/RobertCraigie/pyright-python
rev: v1.1.357
rev: v1.1.367
hooks:
- id: pyright
language_version: "3.9"
Expand Down Expand Up @@ -108,7 +108,7 @@ repos:
- "types-docutils"

- repo: https:/python-jsonschema/check-jsonschema
rev: "0.28.1"
rev: "0.28.5"
hooks:
- id: check-metaschema
name: "Check JSON schemas validity"
Expand All @@ -121,7 +121,7 @@ repos:
files: ^tmt/schemas/.*\.yaml

- repo: https:/ansible-community/ansible-lint.git
rev: v24.2.1
rev: v24.6.0
hooks:
- id: ansible-lint
args:
Expand All @@ -137,15 +137,15 @@ repos:
# in order to be parsed by ansible-lint

- repo: https:/charliermarsh/ruff-pre-commit
rev: v0.3.5
rev: v0.4.9
hooks:
- id: ruff
args:
- '--fix'
- '--show-fixes'

- repo: https:/teemtee/tmt.git
rev: 1.32.1
rev: 1.33.0
hooks:
- id: tmt-lint
additional_dependencies:
Expand All @@ -156,7 +156,7 @@ repos:
# There is *a lot* of them, and hatch might fetch many of them.
- "botocore>=1.25.10" # 1.25.10 is the current one available for RHEL9
- repo: https:/codespell-project/codespell
rev: v2.2.6
rev: v2.3.0
hooks:
- id: codespell
additional_dependencies:
Expand Down
2 changes: 1 addition & 1 deletion examples/redis/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -eux

. "$TMT_TOPOLOGY_BASH"
# verify that TOPLOGY to be defined to be able to run the tests.
# verify that TOPOLOGY to be defined to be able to run the tests.
test -z "${TMT_ROLES[server]}" && exit 125

SERVER=${TMT_GUESTS[${TMT_ROLES[server]}.hostname]}
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_guest.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def test_multihost_name(root_logger: Logger) -> None:
),
(
# shared-connection-closed
os.linesep + 'some-line' + os.linesep + 'Shared connection to 127.0.0.1 closed.' \
os.linesep + 'some-line' + os.linesep + 'Shared connection to 127.0.0.1 closed.'
+ os.linesep,
os.linesep + 'some-line' + os.linesep
)
Expand Down
2 changes: 1 addition & 1 deletion tmt/queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ def go(self) -> Iterator['Self']:
old_loggers: dict[str, Logger] = {}

with ThreadPoolExecutor(max_workers=len(self.guests)) as executor:
futures: dict[Future[None], 'Guest'] = {}
futures: dict[Future[None], Guest] = {}

for guest in self.guests:
# Swap guest's logger for the one we prepared, with labels
Expand Down
6 changes: 3 additions & 3 deletions tmt/steps/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ def __init__(
super().__init__(name=name, parent=plan, workdir=workdir, logger=logger)

# Initialize data
self.plan: 'Plan' = plan
self.plan: Plan = plan
self._status: Optional[str] = None
self._phases: list[Phase] = []

Expand Down Expand Up @@ -761,7 +761,7 @@ def _iter_options() -> Iterator[tuple[str, Any]]:
# compatible, `--update` without `--name` should result in all phases being converted into
# what the `--update` brings in. In this list, we will collect "postponed" CLI invocations,
# and we will get back to them once we're done with those we can apply immediately.
postponed_invocations: list['tmt.cli.CliInvocation'] = []
postponed_invocations: list[tmt.cli.CliInvocation] = []

name_generator = DefaultNameGenerator.from_raw_phases(raw_data)

Expand Down Expand Up @@ -1937,7 +1937,7 @@ class Topology(SerializableContainer):
roles: dict[str, list[str]]

def __init__(self, guests: list['Guest']) -> None:
roles: collections.defaultdict[str, list['Guest']] = collections.defaultdict(list)
roles: collections.defaultdict[str, list[Guest]] = collections.defaultdict(list)

self.guest = None
self.guest_names: list[str] = []
Expand Down
2 changes: 1 addition & 1 deletion tmt/steps/discover/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ def save(self) -> None:
super().save()

# Create tests.yaml with the full test data
raw_test_data: list['tmt.export._RawExportedInstance'] = []
raw_test_data: list[tmt.export._RawExportedInstance] = []

for phase_name, phase_tests in self._tests.items():
for test in phase_tests:
Expand Down
4 changes: 2 additions & 2 deletions tmt/steps/prepare/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,8 @@ def as_key(self) -> frozenset['tmt.base.DependencySimple']:
#
# 1. make the list of requirements unique,
# 2. group guests with same requirements.
pruned_requires: dict[frozenset['tmt.base.DependencySimple'], DependencyCollection] = {}
pruned_recommends: dict[frozenset['tmt.base.DependencySimple'], DependencyCollection] = {}
pruned_requires: dict[frozenset[tmt.base.DependencySimple], DependencyCollection] = {}
pruned_recommends: dict[frozenset[tmt.base.DependencySimple], DependencyCollection] = {}

for guest, collection in collected_requires.items():
collection.dependencies = uniq(collection.dependencies)
Expand Down
4 changes: 2 additions & 2 deletions tmt/steps/prepare/distgit.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,8 @@ def go(
# FIXME needs refactor of Prepare, tmt.base etc...
# doing quick & dirty injection of prepareinstalls
for guest in self.step.plan.provision.guests():
collected_requires: list['tmt.base.DependencySimple'] = []
collected_recommends: list['tmt.base.DependencySimple'] = []
collected_requires: list[tmt.base.DependencySimple] = []
collected_recommends: list[tmt.base.DependencySimple] = []
for test in self.step.plan.discover.tests(enabled=True):
if not test.enabled_on_guest(guest):
continue
Expand Down
2 changes: 1 addition & 1 deletion tmt/steps/prepare/feature/epel-disable.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
when: ansible_distribution in ["RedHat", "CentOS"] and ansible_distribution_major_version | int == 7
block:
- name: Install package 'yum-utils'
ansible.builtin.yum:
ansible.builtin.dnf:
name: yum-utils
state: present

Expand Down
16 changes: 8 additions & 8 deletions tmt/steps/prepare/feature/epel-enable.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
when: ansible_distribution == "RedHat" and ansible_distribution_major_version | int == 7
block:
- name: Install package 'epel-release'
ansible.builtin.yum:
ansible.builtin.dnf:
name: "https://dl.fedoraproject.org/pub/epel/epel-release-latest-{{ ansible_distribution_major_version }}.noarch.rpm"
disable_gpg_check: true
state: present

- name: Install package 'yum-utils'
ansible.builtin.yum:
ansible.builtin.dnf:
name: yum-utils
state: present

Expand All @@ -24,13 +24,13 @@
when: ansible_distribution == "RedHat" and ansible_distribution_major_version | int >= 8
block:
- name: Install package 'epel-release'
ansible.builtin.yum:
ansible.builtin.dnf:
name: "https://dl.fedoraproject.org/pub/epel/epel-release-latest-{{ ansible_distribution_major_version }}.noarch.rpm"
disable_gpg_check: true
state: present

- name: Install package 'epel-next-release'
ansible.builtin.yum:
ansible.builtin.dnf:
name: "https://dl.fedoraproject.org/pub/epel/epel-next-release-latest-{{ ansible_distribution_major_version }}.noarch.rpm"
disable_gpg_check: true
state: present
Expand All @@ -54,12 +54,12 @@
when: ansible_distribution == "CentOS" and ansible_distribution_major_version | int == 7
block:
- name: Install package 'epel-release'
ansible.builtin.yum:
ansible.builtin.dnf:
name: epel-release
state: present

- name: Install package 'yum-utils'
ansible.builtin.yum:
ansible.builtin.dnf:
name: yum-utils
state: present

Expand All @@ -72,12 +72,12 @@
when: ansible_distribution == "CentOS" and ansible_distribution_major_version | int >= 8
block:
- name: Install package 'epel-release'
ansible.builtin.yum:
ansible.builtin.dnf:
name: epel-release
state: present

- name: Install package 'epel-next-release'
ansible.builtin.yum:
ansible.builtin.dnf:
name: epel-next-release
state: present

Expand Down
8 changes: 4 additions & 4 deletions tmt/steps/provision/mrack.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,10 +447,10 @@ def _transform_zcrypt_mode(
'disk.size': _transform_disk_size, # type: ignore[dict-item]
'hostname': _transform_hostname, # type: ignore[dict-item]
'memory': _transform_memory, # type: ignore[dict-item]
'virtualization.is_virtualized': \
_transform_virtualization_is_virtualized, # type: ignore[dict-item]
'virtualization.hypervisor': \
_transform_virtualization_hypervisor, # type: ignore[dict-item]
'virtualization.is_virtualized':
_transform_virtualization_is_virtualized, # type: ignore[dict-item]
'virtualization.hypervisor':
_transform_virtualization_hypervisor, # type: ignore[dict-item]
'zcrypt.adapter': _transform_zcrypt_adapter, # type: ignore[dict-item]
'zcrypt.mode': _transform_zcrypt_mode, # type: ignore[dict-item]
}
Expand Down
2 changes: 1 addition & 1 deletion tmt/steps/provision/testcloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ def _apply_hw_disk_size(
logger: tmt.log.Logger) -> None:
""" Apply ``disk`` constraint to given VM domain """

final_size: 'Size' = DEFAULT_DISK
final_size: Size = DEFAULT_DISK

def _generate_disk_filepaths() -> Iterator[Path]:
""" Generate paths to use for files representing VM storage """
Expand Down
4 changes: 2 additions & 2 deletions tmt/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1469,7 +1469,7 @@ def __init__(cls, *args: Any, **kwargs: Any) -> None:
# of the assignment below. That's incomplete, and leads to mypy warning
# about assignments of `CliInvocation` instances to this attribute.
# Repeating the annotation silences mypy, giving it better picture.
cls.cli_invocation: Optional['tmt.cli.CliInvocation'] = None
cls.cli_invocation: Optional[tmt.cli.CliInvocation] = None


class Common(_CommonBase, metaclass=_CommonMeta):
Expand Down Expand Up @@ -2197,7 +2197,7 @@ class _MultiInvokableCommonMeta(_CommonMeta):
def __init__(cls, *args: Any, **kwargs: Any) -> None: # noqa: N805
super().__init__(*args, **kwargs)

cls.cli_invocations: list['tmt.cli.CliInvocation'] = []
cls.cli_invocations: list[tmt.cli.CliInvocation] = []


class MultiInvokableCommon(Common, metaclass=_MultiInvokableCommonMeta):
Expand Down
Loading