ansible-test - Code style cleanup (#84749)

* ansible-test - Minor style cleanup (add blank lines)

* ansible-test - Use `"""` instead of `'''`
pull/83569/merge
Matt Clay 9 months ago committed by GitHub
parent e9e6001263
commit 5ff8d093f0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -1,4 +1,5 @@
"""Test runner for all Ansible tests.""" """Test runner for all Ansible tests."""
from __future__ import annotations from __future__ import annotations
import os import os

@ -1,4 +1,5 @@
"""Miscellaneous utility functions and classes specific to ansible cli tools.""" """Miscellaneous utility functions and classes specific to ansible cli tools."""
from __future__ import annotations from __future__ import annotations
import json import json

@ -1,4 +1,5 @@
"""Become abstraction for interacting with test hosts.""" """Become abstraction for interacting with test hosts."""
from __future__ import annotations from __future__ import annotations
import abc import abc

@ -1,4 +1,5 @@
"""Bootstrapping for test hosts.""" """Bootstrapping for test hosts."""
from __future__ import annotations from __future__ import annotations
import dataclasses import dataclasses

@ -1,4 +1,5 @@
"""Cache for commonly shared data that is intended to be immutable.""" """Cache for commonly shared data that is intended to be immutable."""
from __future__ import annotations from __future__ import annotations
import collections.abc as c import collections.abc as c

@ -1,4 +1,5 @@
"""Linux control group constants, classes and utilities.""" """Linux control group constants, classes and utilities."""
from __future__ import annotations from __future__ import annotations
import codecs import codecs

@ -1,4 +1,5 @@
"""Support code for CI environments.""" """Support code for CI environments."""
from __future__ import annotations from __future__ import annotations
import abc import abc

@ -1,4 +1,5 @@
"""Support code for working with Azure Pipelines.""" """Support code for working with Azure Pipelines."""
from __future__ import annotations from __future__ import annotations
import os import os

@ -1,4 +1,5 @@
"""Support code for working without a supported CI provider.""" """Support code for working without a supported CI provider."""
from __future__ import annotations from __future__ import annotations
import os import os

@ -1,4 +1,5 @@
"""Classify changes in Ansible code.""" """Classify changes in Ansible code."""
from __future__ import annotations from __future__ import annotations
import collections import collections

@ -1,4 +1,5 @@
"""Common classification code used by multiple languages.""" """Common classification code used by multiple languages."""
from __future__ import annotations from __future__ import annotations
import os import os

@ -1,4 +1,5 @@
"""Analyze C# import statements.""" """Analyze C# import statements."""
from __future__ import annotations from __future__ import annotations
import os import os

@ -1,4 +1,5 @@
"""Analyze powershell import statements.""" """Analyze powershell import statements."""
from __future__ import annotations from __future__ import annotations
import os import os

@ -1,4 +1,5 @@
"""Analyze python import statements.""" """Analyze python import statements."""
from __future__ import annotations from __future__ import annotations
import ast import ast

@ -1,4 +1,5 @@
"""Command line parsing.""" """Command line parsing."""
from __future__ import annotations from __future__ import annotations
import argparse import argparse

@ -1,4 +1,5 @@
"""Actions for handling composite arguments with argparse.""" """Actions for handling composite arguments with argparse."""
from __future__ import annotations from __future__ import annotations
from .argparsing import ( from .argparsing import (

@ -1,4 +1,5 @@
"""Completion finder which brings together custom options and completion logic.""" """Completion finder which brings together custom options and completion logic."""
from __future__ import annotations from __future__ import annotations
import abc import abc

@ -1,4 +1,5 @@
"""Actions for argparse.""" """Actions for argparse."""
from __future__ import annotations from __future__ import annotations
import argparse import argparse

@ -1,4 +1,5 @@
"""Wrapper around argcomplete providing bug fixes and additional features.""" """Wrapper around argcomplete providing bug fixes and additional features."""
from __future__ import annotations from __future__ import annotations
import argparse import argparse

@ -1,4 +1,5 @@
"""General purpose composite argument parsing and completion.""" """General purpose composite argument parsing and completion."""
from __future__ import annotations from __future__ import annotations
import abc import abc

@ -1,4 +1,5 @@
"""Command line parsing for all commands.""" """Command line parsing for all commands."""
from __future__ import annotations from __future__ import annotations
import argparse import argparse

@ -1,4 +1,5 @@
"""Command line parsing for all `coverage` commands.""" """Command line parsing for all `coverage` commands."""
from __future__ import annotations from __future__ import annotations
import argparse import argparse

@ -1,4 +1,5 @@
"""Command line parsing for all `coverage analyze` commands.""" """Command line parsing for all `coverage analyze` commands."""
from __future__ import annotations from __future__ import annotations
import argparse import argparse

@ -1,4 +1,5 @@
"""Command line parsing for all `coverage analyze targets` commands.""" """Command line parsing for all `coverage analyze targets` commands."""
from __future__ import annotations from __future__ import annotations
import argparse import argparse

@ -1,4 +1,5 @@
"""Command line parsing for the `coverage analyze targets combine` command.""" """Command line parsing for the `coverage analyze targets combine` command."""
from __future__ import annotations from __future__ import annotations
import argparse import argparse

@ -1,4 +1,5 @@
"""Command line parsing for the `coverage analyze targets expand` command.""" """Command line parsing for the `coverage analyze targets expand` command."""
from __future__ import annotations from __future__ import annotations
import argparse import argparse

@ -1,4 +1,5 @@
"""Command line parsing for the `coverage analyze targets filter` command.""" """Command line parsing for the `coverage analyze targets filter` command."""
from __future__ import annotations from __future__ import annotations
import argparse import argparse

@ -1,4 +1,5 @@
"""Command line parsing for the `coverage analyze targets generate` command.""" """Command line parsing for the `coverage analyze targets generate` command."""
from __future__ import annotations from __future__ import annotations
import argparse import argparse

@ -1,4 +1,5 @@
"""Command line parsing for the `coverage analyze targets missing` command.""" """Command line parsing for the `coverage analyze targets missing` command."""
from __future__ import annotations from __future__ import annotations
import argparse import argparse

@ -1,4 +1,5 @@
"""Command line parsing for the `coverage combine` command.""" """Command line parsing for the `coverage combine` command."""
from __future__ import annotations from __future__ import annotations
import argparse import argparse

@ -1,4 +1,5 @@
"""Command line parsing for the `coverage erase` command.""" """Command line parsing for the `coverage erase` command."""
from __future__ import annotations from __future__ import annotations
import argparse import argparse

@ -1,4 +1,5 @@
"""Command line parsing for the `coverage html` command.""" """Command line parsing for the `coverage html` command."""
from __future__ import annotations from __future__ import annotations
import argparse import argparse

@ -1,4 +1,5 @@
"""Command line parsing for the `coverage report` command.""" """Command line parsing for the `coverage report` command."""
from __future__ import annotations from __future__ import annotations
import argparse import argparse

@ -1,4 +1,5 @@
"""Command line parsing for the `coverage xml` command.""" """Command line parsing for the `coverage xml` command."""
from __future__ import annotations from __future__ import annotations
import argparse import argparse

@ -1,4 +1,5 @@
"""Command line parsing for the `env` command.""" """Command line parsing for the `env` command."""
from __future__ import annotations from __future__ import annotations
import argparse import argparse

@ -1,4 +1,5 @@
"""Command line parsing for all integration commands.""" """Command line parsing for all integration commands."""
from __future__ import annotations from __future__ import annotations
import argparse import argparse

@ -1,4 +1,5 @@
"""Command line parsing for the `network-integration` command.""" """Command line parsing for the `network-integration` command."""
from __future__ import annotations from __future__ import annotations
import argparse import argparse

@ -1,4 +1,5 @@
"""Command line parsing for the `integration` command.""" """Command line parsing for the `integration` command."""
from __future__ import annotations from __future__ import annotations
import argparse import argparse

@ -1,4 +1,5 @@
"""Command line parsing for the `windows-integration` command.""" """Command line parsing for the `windows-integration` command."""
from __future__ import annotations from __future__ import annotations
import argparse import argparse

@ -1,4 +1,5 @@
"""Command line parsing for the `sanity` command.""" """Command line parsing for the `sanity` command."""
from __future__ import annotations from __future__ import annotations
import argparse import argparse

@ -1,4 +1,5 @@
"""Command line parsing for the `shell` command.""" """Command line parsing for the `shell` command."""
from __future__ import annotations from __future__ import annotations
import argparse import argparse

@ -1,4 +1,5 @@
"""Command line parsing for the `units` command.""" """Command line parsing for the `units` command."""
from __future__ import annotations from __future__ import annotations
import argparse import argparse

@ -1,4 +1,5 @@
"""Provides compatibility with first-generation host delegation options in ansible-test.""" """Provides compatibility with first-generation host delegation options in ansible-test."""
from __future__ import annotations from __future__ import annotations
import argparse import argparse

@ -1,4 +1,5 @@
"""Completers for use with argcomplete.""" """Completers for use with argcomplete."""
from __future__ import annotations from __future__ import annotations
import argparse import argparse

@ -1,4 +1,5 @@
"""Converters for use as the type argument for arparse's add_argument method.""" """Converters for use as the type argument for arparse's add_argument method."""
from __future__ import annotations from __future__ import annotations
import argparse import argparse

@ -1,4 +1,5 @@
"""Command line parsing for test environments.""" """Command line parsing for test environments."""
from __future__ import annotations from __future__ import annotations
import argparse import argparse

@ -1,4 +1,5 @@
"""Argument parsing epilog generation.""" """Argument parsing epilog generation."""
from __future__ import annotations from __future__ import annotations
from .argparsing import ( from .argparsing import (

@ -1,4 +1,5 @@
"""Composite argument parsers for ansible-test specific command-line arguments.""" """Composite argument parsers for ansible-test specific command-line arguments."""
from __future__ import annotations from __future__ import annotations
import typing as t import typing as t

@ -1,4 +1,5 @@
"""Base classes for the primary parsers for composite command line arguments.""" """Base classes for the primary parsers for composite command line arguments."""
from __future__ import annotations from __future__ import annotations
import abc import abc

@ -1,4 +1,5 @@
"""Helper functions for composite parsers.""" """Helper functions for composite parsers."""
from __future__ import annotations from __future__ import annotations
from ...constants import ( from ...constants import (

@ -1,4 +1,5 @@
"""Composite parsers for the various types of hosts.""" """Composite parsers for the various types of hosts."""
from __future__ import annotations from __future__ import annotations
import typing as t import typing as t

@ -1,4 +1,5 @@
"""Composite argument key-value parsers used by other parsers.""" """Composite argument key-value parsers used by other parsers."""
from __future__ import annotations from __future__ import annotations
import typing as t import typing as t

@ -1,4 +1,5 @@
"""Composite argument value parsers used by other parsers.""" """Composite argument value parsers used by other parsers."""
from __future__ import annotations from __future__ import annotations
import collections.abc as c import collections.abc as c

@ -1,2 +1,3 @@
"""Nearly empty __init__.py to keep pylint happy.""" """Nearly empty __init__.py to keep pylint happy."""
from __future__ import annotations from __future__ import annotations

@ -1,4 +1,5 @@
"""Common logic for the coverage subcommand.""" """Common logic for the coverage subcommand."""
from __future__ import annotations from __future__ import annotations
import collections.abc as c import collections.abc as c
@ -226,7 +227,7 @@ def read_python_coverage_legacy(path: str) -> PythonArcs:
"""Return coverage arcs from the specified coverage file, which must be in the legacy JSON format.""" """Return coverage arcs from the specified coverage file, which must be in the legacy JSON format."""
try: try:
contents = read_text_file(path) contents = read_text_file(path)
contents = re.sub(r'''^!coverage.py: This is a private format, don't read it directly!''', '', contents) contents = re.sub(r"""^!coverage.py: This is a private format, don't read it directly!""", '', contents)
data = json.loads(contents) data = json.loads(contents)
arcs: PythonArcs = {filename: [t.cast(tuple[int, int], tuple(arc)) for arc in arc_list] for filename, arc_list in data['arcs'].items()} arcs: PythonArcs = {filename: [t.cast(tuple[int, int], tuple(arc)) for arc in arc_list] for filename, arc_list in data['arcs'].items()}
except Exception as ex: except Exception as ex:

@ -1,4 +1,5 @@
"""Common logic for the `coverage analyze` subcommand.""" """Common logic for the `coverage analyze` subcommand."""
from __future__ import annotations from __future__ import annotations
import typing as t import typing as t

@ -1,4 +1,5 @@
"""Analyze integration test target code coverage.""" """Analyze integration test target code coverage."""
from __future__ import annotations from __future__ import annotations
import collections.abc as c import collections.abc as c

@ -1,4 +1,5 @@
"""Combine integration test target code coverage reports.""" """Combine integration test target code coverage reports."""
from __future__ import annotations from __future__ import annotations
import typing as t import typing as t

@ -1,4 +1,5 @@
"""Expand target names in an aggregated coverage file.""" """Expand target names in an aggregated coverage file."""
from __future__ import annotations from __future__ import annotations
import typing as t import typing as t

@ -1,4 +1,5 @@
"""Filter an aggregated coverage file, keeping only the specified targets.""" """Filter an aggregated coverage file, keeping only the specified targets."""
from __future__ import annotations from __future__ import annotations
import collections.abc as c import collections.abc as c

@ -1,4 +1,5 @@
"""Analyze code coverage data to determine which integration test targets provide coverage for each arc or line.""" """Analyze code coverage data to determine which integration test targets provide coverage for each arc or line."""
from __future__ import annotations from __future__ import annotations
import os import os

@ -1,4 +1,5 @@
"""Identify aggregated coverage in one file missing from another.""" """Identify aggregated coverage in one file missing from another."""
from __future__ import annotations from __future__ import annotations
import os import os

@ -1,4 +1,5 @@
"""Combine code coverage files.""" """Combine code coverage files."""
from __future__ import annotations from __future__ import annotations
import collections.abc as c import collections.abc as c

@ -1,4 +1,5 @@
"""Erase code coverage files.""" """Erase code coverage files."""
from __future__ import annotations from __future__ import annotations
import os import os

@ -1,4 +1,5 @@
"""Generate HTML code coverage reports.""" """Generate HTML code coverage reports."""
from __future__ import annotations from __future__ import annotations
import os import os

@ -1,4 +1,5 @@
"""Generate console code coverage reports.""" """Generate console code coverage reports."""
from __future__ import annotations from __future__ import annotations
import os import os

@ -1,4 +1,5 @@
"""Generate XML code coverage reports.""" """Generate XML code coverage reports."""
from __future__ import annotations from __future__ import annotations
import os import os

@ -1,4 +1,5 @@
"""Show information about the test environment.""" """Show information about the test environment."""
from __future__ import annotations from __future__ import annotations
import datetime import datetime
@ -49,6 +50,7 @@ from ...timeout import (
class EnvConfig(CommonConfig): class EnvConfig(CommonConfig):
"""Configuration for the `env` command.""" """Configuration for the `env` command."""
def __init__(self, args: t.Any) -> None: def __init__(self, args: t.Any) -> None:
super().__init__(args, 'env') super().__init__(args, 'env')

@ -1,4 +1,5 @@
"""Ansible integration test infrastructure.""" """Ansible integration test infrastructure."""
from __future__ import annotations from __future__ import annotations
import collections.abc as c import collections.abc as c

@ -1,4 +1,5 @@
"""Plugin system for cloud providers and environments for use in integration tests.""" """Plugin system for cloud providers and environments for use in integration tests."""
from __future__ import annotations from __future__ import annotations
import abc import abc

@ -1,4 +1,5 @@
"""ACME plugin for integration tests.""" """ACME plugin for integration tests."""
from __future__ import annotations from __future__ import annotations
import os import os

@ -1,4 +1,5 @@
"""AWS plugin for integration tests.""" """AWS plugin for integration tests."""
from __future__ import annotations from __future__ import annotations
import os import os

@ -1,4 +1,5 @@
"""Azure plugin for integration tests.""" """Azure plugin for integration tests."""
from __future__ import annotations from __future__ import annotations
import configparser import configparser

@ -1,4 +1,5 @@
"""CloudStack plugin for integration tests.""" """CloudStack plugin for integration tests."""
from __future__ import annotations from __future__ import annotations
import json import json

@ -1,4 +1,5 @@
"""DigitalOcean plugin for integration tests.""" """DigitalOcean plugin for integration tests."""
from __future__ import annotations from __future__ import annotations
import configparser import configparser

@ -1,4 +1,5 @@
"""Galaxy (ansible-galaxy) plugin for integration tests.""" """Galaxy (ansible-galaxy) plugin for integration tests."""
from __future__ import annotations from __future__ import annotations
import os import os
@ -69,7 +70,7 @@ SETTINGS = {
} }
GALAXY_IMPORTER = b''' GALAXY_IMPORTER = b"""
[galaxy-importer] [galaxy-importer]
ansible_local_tmp=~/.ansible/tmp ansible_local_tmp=~/.ansible/tmp
ansible_test_local_image=false ansible_test_local_image=false
@ -84,7 +85,7 @@ run_ansible_doc=false
run_ansible_lint=false run_ansible_lint=false
run_ansible_test=false run_ansible_test=false
run_flake8=false run_flake8=false
'''.strip() """.strip()
class GalaxyProvider(CloudProvider): class GalaxyProvider(CloudProvider):

@ -1,4 +1,5 @@
"""Hetzner Cloud plugin for integration tests.""" """Hetzner Cloud plugin for integration tests."""
from __future__ import annotations from __future__ import annotations
import configparser import configparser

@ -1,4 +1,5 @@
"""HTTP Tester plugin for integration tests.""" """HTTP Tester plugin for integration tests."""
from __future__ import annotations from __future__ import annotations
import os import os

@ -1,4 +1,5 @@
"""NIOS plugin for integration tests.""" """NIOS plugin for integration tests."""
from __future__ import annotations from __future__ import annotations
import os import os

@ -1,4 +1,5 @@
"""OpenNebula plugin for integration tests.""" """OpenNebula plugin for integration tests."""
from __future__ import annotations from __future__ import annotations
import configparser import configparser

@ -1,4 +1,5 @@
"""OpenShift plugin for integration tests.""" """OpenShift plugin for integration tests."""
from __future__ import annotations from __future__ import annotations
import re import re

@ -1,4 +1,5 @@
"""Scaleway plugin for integration tests.""" """Scaleway plugin for integration tests."""
from __future__ import annotations from __future__ import annotations
import configparser import configparser

@ -1,4 +1,5 @@
"""VMware vCenter plugin for integration tests.""" """VMware vCenter plugin for integration tests."""
from __future__ import annotations from __future__ import annotations
import configparser import configparser

@ -1,4 +1,5 @@
"""Vultr plugin for integration tests.""" """Vultr plugin for integration tests."""
from __future__ import annotations from __future__ import annotations
import configparser import configparser

@ -1,4 +1,5 @@
"""Code coverage support for integration tests.""" """Code coverage support for integration tests."""
from __future__ import annotations from __future__ import annotations
import abc import abc

@ -1,4 +1,5 @@
"""Logic for filtering out integration test targets which are unsupported for the currently provided arguments and available hosts.""" """Logic for filtering out integration test targets which are unsupported for the currently provided arguments and available hosts."""
from __future__ import annotations from __future__ import annotations
import abc import abc

@ -1,4 +1,5 @@
"""Network integration testing.""" """Network integration testing."""
from __future__ import annotations from __future__ import annotations
import os import os

@ -1,4 +1,5 @@
"""POSIX integration testing.""" """POSIX integration testing."""
from __future__ import annotations from __future__ import annotations
import os import os

@ -1,4 +1,5 @@
"""Windows integration testing.""" """Windows integration testing."""
from __future__ import annotations from __future__ import annotations
import os import os

@ -1,4 +1,5 @@
"""Execute Ansible sanity tests.""" """Execute Ansible sanity tests."""
from __future__ import annotations from __future__ import annotations
import abc import abc

@ -1,4 +1,5 @@
"""Sanity test for ansible-doc.""" """Sanity test for ansible-doc."""
from __future__ import annotations from __future__ import annotations
import collections import collections

@ -1,4 +1,5 @@
"""Sanity test for symlinks in the bin directory.""" """Sanity test for symlinks in the bin directory."""
from __future__ import annotations from __future__ import annotations
import os import os

@ -1,4 +1,5 @@
"""Sanity test for proper python syntax.""" """Sanity test for proper python syntax."""
from __future__ import annotations from __future__ import annotations
import os import os

@ -1,4 +1,5 @@
"""Sanity test for the sanity ignore file.""" """Sanity test for the sanity ignore file."""
from __future__ import annotations from __future__ import annotations
import os import os

@ -1,4 +1,5 @@
"""Sanity test for proper import exception handling.""" """Sanity test for proper import exception handling."""
from __future__ import annotations from __future__ import annotations
import collections.abc as c import collections.abc as c

@ -1,4 +1,5 @@
"""Sanity test to check integration test aliases.""" """Sanity test to check integration test aliases."""
from __future__ import annotations from __future__ import annotations
import dataclasses import dataclasses

@ -1,4 +1,5 @@
"""Sanity test for PEP 8 style guidelines using pycodestyle.""" """Sanity test for PEP 8 style guidelines using pycodestyle."""
from __future__ import annotations from __future__ import annotations
import os import os

@ -1,4 +1,5 @@
"""Sanity test using PSScriptAnalyzer.""" """Sanity test using PSScriptAnalyzer."""
from __future__ import annotations from __future__ import annotations
import json import json

@ -1,4 +1,5 @@
"""Sanity test using pylint.""" """Sanity test using pylint."""
from __future__ import annotations from __future__ import annotations
import collections.abc as c import collections.abc as c

@ -1,4 +1,5 @@
"""Sanity test using shellcheck.""" """Sanity test using shellcheck."""
from __future__ import annotations from __future__ import annotations
import os import os

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save