Add future and metaclass boilerplate to test code.

Continue to ignore:

- test/integration/
- test/legacy/
- test/units/
This commit is contained in:
Matt Clay 2019-07-11 23:46:20 -07:00
parent f98a4ef2f7
commit 3f2b766d10
106 changed files with 220 additions and 100 deletions

View file

@ -1,6 +1,8 @@
#!/usr/bin/env python
# PYTHON_ARGCOMPLETE_OK
"""Legacy entry point for ansible-test. The preferred version is in the bin directory."""
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import lib.cli

View file

@ -1,5 +1,7 @@
#!/usr/bin/env python
"""Provides an entry point for python scripts and python modules on the controller with the current python interpreter and optional code coverage collection."""
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import sys

View file

@ -1 +1,3 @@
"""Support code for Ansible testing infrastructure."""
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type

View file

@ -1,6 +1,6 @@
"""Miscellaneous utility functions and classes specific to ansible cli tools."""
from __future__ import absolute_import, print_function
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import json
import os

View file

@ -1,6 +1,6 @@
"""Cache for commonly shared data that is intended to be immutable."""
from __future__ import absolute_import, print_function
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
class CommonCache(object):

View file

@ -1,6 +1,6 @@
"""Detect changes in Ansible code."""
from __future__ import absolute_import, print_function
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import re
import os

View file

@ -1,6 +1,6 @@
"""Classify changes in Ansible code."""
from __future__ import absolute_import, print_function
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import collections
import os

View file

@ -1,6 +1,6 @@
"""Test runner for all Ansible tests."""
from __future__ import absolute_import, print_function
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import errno
import os

View file

@ -1,5 +1,6 @@
"""Plugin system for cloud providers and environments for use in integration tests."""
from __future__ import absolute_import, print_function
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import abc
import atexit

View file

@ -1,5 +1,6 @@
"""ACME plugin for integration tests."""
from __future__ import absolute_import, print_function
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import time

View file

@ -1,5 +1,6 @@
"""AWS plugin for integration tests."""
from __future__ import absolute_import, print_function
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os

View file

@ -1,5 +1,6 @@
"""Azure plugin for integration tests."""
from __future__ import absolute_import, print_function
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os

View file

@ -4,7 +4,8 @@
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
"""Cloudscale plugin for integration tests."""
from __future__ import absolute_import, print_function
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from os.path import isfile

View file

@ -1,5 +1,6 @@
"""CloudStack plugin for integration tests."""
from __future__ import absolute_import, print_function
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import json
import os

View file

@ -1,6 +1,6 @@
"""Foreman plugin for integration tests."""
from __future__ import absolute_import, print_function
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os

View file

@ -1,7 +1,8 @@
# Copyright: (c) 2018, Google Inc.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
"""GCP plugin for integration tests."""
from __future__ import absolute_import, print_function
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os

View file

@ -1,5 +1,6 @@
"""Hetzner Cloud plugin for integration tests."""
from __future__ import absolute_import, print_function
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os

View file

@ -1,6 +1,6 @@
"""NIOS plugin for integration tests."""
from __future__ import absolute_import, print_function
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os

View file

@ -1,4 +1,6 @@
"""OpenNebula plugin for integration tests."""
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from lib.cloud import (
CloudProvider,

View file

@ -1,5 +1,6 @@
"""OpenShift plugin for integration tests."""
from __future__ import absolute_import, print_function
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import json
import os

View file

@ -1,5 +1,6 @@
"""Scaleway plugin for integration tests."""
from __future__ import absolute_import, print_function
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os

View file

@ -1,5 +1,6 @@
"""Tower plugin for integration tests."""
from __future__ import absolute_import, print_function
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import time

View file

@ -1,5 +1,6 @@
"""VMware vCenter plugin for integration tests."""
from __future__ import absolute_import, print_function
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import time

View file

@ -1,5 +1,6 @@
"""Vultr plugin for integration tests."""
from __future__ import absolute_import, print_function
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os

View file

@ -1,6 +1,6 @@
"""Configuration classes."""
from __future__ import absolute_import, print_function
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import sys

View file

@ -1,4 +1,6 @@
"""Constants used by ansible-test. Imports should not be used in this file."""
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
# Setting a low soft RLIMIT_NOFILE value will improve the performance of subprocess.Popen on Python 2.x when close_fds=True.
# This will affect all Python subprocesses. It will also affect the current Python process if set before subprocess is imported for the first time.

View file

@ -1,6 +1,6 @@
"""Access Ansible Core CI remote services."""
from __future__ import absolute_import, print_function
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import json
import os

View file

@ -1,6 +1,6 @@
"""Code coverage utilities."""
from __future__ import absolute_import, print_function
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import re

View file

@ -1,6 +1,6 @@
"""Analyze C# import statements."""
from __future__ import absolute_import, print_function
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import re

View file

@ -1,6 +1,6 @@
"""Delegate test execution to another environment."""
from __future__ import absolute_import, print_function
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import re

View file

@ -1,5 +1,6 @@
"""Diff parsing functions and classes."""
from __future__ import absolute_import, print_function
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import re
import textwrap

View file

@ -1,6 +1,6 @@
"""Functions for accessing docker via the docker cli."""
from __future__ import absolute_import, print_function
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import json
import os

View file

@ -1,6 +1,6 @@
"""Show information about the test environment."""
from __future__ import absolute_import, print_function
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import datetime
import json

View file

@ -1,6 +1,6 @@
"""Execute Ansible tests."""
from __future__ import absolute_import, print_function
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import json
import os

View file

@ -1,6 +1,6 @@
"""Wrapper around git command-line tools."""
from __future__ import absolute_import, print_function
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import lib.types as t

View file

@ -2,8 +2,8 @@
Primitive replacement for requests to avoid extra dependency.
Avoids use of urllib2 due to lack of SNI support.
"""
from __future__ import absolute_import, print_function
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import json
import time

View file

@ -1,6 +1,6 @@
"""Analyze python import statements."""
from __future__ import absolute_import, print_function
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import ast
import os

View file

@ -1,4 +1,6 @@
"""Early initialization for ansible-test before most other imports have been performed."""
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import resource

View file

@ -1,6 +1,6 @@
"""Ansible integration test infrastructure."""
from __future__ import absolute_import, print_function
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import contextlib
import json

View file

@ -1,6 +1,6 @@
"""Access Ansible Core CI remote services."""
from __future__ import absolute_import, print_function
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import tempfile

View file

@ -1,5 +1,6 @@
"""Test metadata for passing data to delegated tests."""
from __future__ import absolute_import, print_function
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import json

View file

@ -1,6 +1,6 @@
"""Analyze powershell import statements."""
from __future__ import absolute_import, print_function
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import re

View file

@ -1,6 +1,6 @@
"""Python native TGZ creation."""
from __future__ import absolute_import, print_function
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import abc
import tarfile

View file

@ -1,5 +1,6 @@
"""Execute Ansible sanity tests."""
from __future__ import absolute_import, print_function
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import abc
import glob

View file

@ -1,5 +1,6 @@
"""Sanity test for ansible-doc."""
from __future__ import absolute_import, print_function
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import collections
import os

View file

@ -1,5 +1,6 @@
"""Sanity test for proper python syntax."""
from __future__ import absolute_import, print_function
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os

View file

@ -1,5 +1,6 @@
"""Sanity test for proper import exception handling."""
from __future__ import absolute_import, print_function
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os

View file

@ -1,5 +1,6 @@
"""Sanity test to check integration test aliases."""
from __future__ import absolute_import, print_function
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import json
import textwrap

View file

@ -1,5 +1,6 @@
"""Sanity test for PEP 8 style guidelines using pycodestyle."""
from __future__ import absolute_import, print_function
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import re

View file

@ -1,5 +1,6 @@
"""Sanity test using PSScriptAnalyzer."""
from __future__ import absolute_import, print_function
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import collections
import json

View file

@ -1,5 +1,6 @@
"""Sanity test using pylint."""
from __future__ import absolute_import, print_function
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import collections
import itertools

View file

@ -1,5 +1,6 @@
"""Sanity test using rstcheck."""
from __future__ import absolute_import, print_function
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os

View file

@ -1,5 +1,6 @@
"""Sanity test for documentation of sanity tests."""
from __future__ import absolute_import, print_function
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os

View file

@ -1,5 +1,6 @@
"""Sanity test using shellcheck."""
from __future__ import absolute_import, print_function
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os

View file

@ -1,5 +1,6 @@
"""Sanity test using validate-modules."""
from __future__ import absolute_import, print_function
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import collections
import json

View file

@ -1,5 +1,6 @@
"""Sanity test using yamllint."""
from __future__ import absolute_import, print_function
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import json
import os

View file

@ -1,6 +1,6 @@
"""Test target identification, iteration and inclusion/exclusion."""
from __future__ import absolute_import, print_function
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import collections
import os

View file

@ -1,6 +1,6 @@
"""Classes for storing and processing test results."""
from __future__ import absolute_import, print_function
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import datetime
import json

View file

@ -1,6 +1,6 @@
"""Python threading tools."""
from __future__ import absolute_import, print_function
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import threading
import sys

View file

@ -1,6 +1,6 @@
"""Miscellaneous utility functions and classes."""
from __future__ import absolute_import, print_function
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import contextlib
import errno

View file

@ -1,5 +1,6 @@
"""Common utility code that depends on CommonConfig."""
from __future__ import absolute_import, print_function
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import atexit
import contextlib

View file

@ -1,8 +1,8 @@
#!/usr/bin/env python
# PYTHON_ARGCOMPLETE_OK
"""Automatically retry failed commands."""
from __future__ import absolute_import, print_function
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
# noinspection PyCompatibility
import argparse

View file

@ -1,8 +1,8 @@
#!/usr/bin/env python
# PYTHON_ARGCOMPLETE_OK
"""Verify the current Shippable run has the required number of jobs."""
from __future__ import absolute_import, print_function
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
# noinspection PyCompatibility
import argparse

View file

@ -1,4 +1,7 @@
"""Tests for diff module."""
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import subprocess
import pytest

View file

@ -1,5 +1,7 @@
#!/usr/bin/env python
"""Show python and pip versions."""
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import sys

View file

@ -1,5 +1,7 @@
#!/usr/bin/env python
"""Show python and pip versions."""
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import json

View file

@ -1,5 +1,7 @@
#!/usr/bin/env python
"""Test to verify action plugins have an associated module to provide documentation."""
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import sys

View file

@ -1,5 +1,7 @@
#!/usr/bin/env python
"""Make sure the Azure requirements files match."""
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import filecmp
import os

View file

@ -1,5 +1,7 @@
#!/usr/bin/env python
"""Make sure the data in BOTMETA.yml is valid"""
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import glob
import os

View file

@ -1,4 +1,6 @@
#!/usr/bin/env python
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import sys

View file

@ -1,4 +1,6 @@
#!/usr/bin/env python
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os

View file

@ -1,4 +1,6 @@
#!/usr/bin/env python
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import re

View file

@ -1,4 +1,6 @@
#!/usr/bin/env python
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import sys

View file

@ -1,4 +1,6 @@
#!/usr/bin/env python
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import sys
@ -20,7 +22,9 @@ def main():
'contrib/vault/',
'docs/',
'examples/',
'test/',
'test/integration/',
'test/legacy/',
'test/units/',
)
# These files pre-date the boilerplate test and should be fixed up as time goes on

View file

@ -1,4 +1,6 @@
#!/usr/bin/env python
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import sys

View file

@ -1,4 +1,6 @@
#!/usr/bin/env python
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import sys
@ -18,7 +20,9 @@ def main():
'contrib/vault/',
'docs/',
'examples/',
'test/'
'test/integration/',
'test/legacy/',
'test/units/',
)
grandfathered = frozenset((

View file

@ -1,5 +1,6 @@
#!/usr/bin/env python
from __future__ import print_function
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import re

View file

@ -1,4 +1,6 @@
#!/usr/bin/env python
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import re

View file

@ -1,4 +1,6 @@
#!/usr/bin/env python
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import re

View file

@ -1,4 +1,6 @@
#!/usr/bin/env python
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import re

View file

@ -1,4 +1,6 @@
#!/usr/bin/env python
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import re

View file

@ -1,4 +1,6 @@
#!/usr/bin/env python
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import re

View file

@ -3,6 +3,8 @@
# a script to check for illegal filenames on various Operating Systems. The
# main rules are derived from restrictions on Windows
# https://msdn.microsoft.com/en-us/library/aa365247#naming_conventions
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import re

View file

@ -1,5 +1,6 @@
#!/usr/bin/env python
from __future__ import print_function
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import re

View file

@ -1,5 +1,7 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import re

View file

@ -1,4 +1,6 @@
#!/usr/bin/env python
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import re

View file

@ -1,5 +1,8 @@
#!/usr/bin/env python
"""Prevent unwanted files from being added to the source tree."""
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import sys

View file

@ -1,4 +1,6 @@
#!/usr/bin/env python
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import re

View file

@ -1,4 +1,6 @@
#!/usr/bin/env python
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import re

View file

@ -1,4 +1,6 @@
#!/usr/bin/env python
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import stat

View file

@ -1,4 +1,6 @@
#!/usr/bin/env python
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os

View file

@ -1,4 +1,6 @@
#!/usr/bin/env python
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import re
import sys

View file

@ -1,4 +1,6 @@
#!/usr/bin/env python
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import re
import sys

View file

@ -1,4 +1,6 @@
#!/usr/bin/env python
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import re

View file

@ -1,5 +1,7 @@
#!/usr/bin/env python
"""Python syntax checker with lint friendly output."""
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import parser
import sys

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python
"""Import the given python module(s) and report error(s) encountered."""
from __future__ import absolute_import, print_function
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import contextlib
import os

View file

@ -15,5 +15,6 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
__version__ = '0.0.1b'

View file

@ -16,8 +16,8 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from __future__ import print_function
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import abc
import argparse

View file

@ -15,6 +15,8 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import imp
import json

View file

@ -3,6 +3,8 @@
# Copyright: (c) 2015, Matt Martz <matt@sivel.net>
# Copyright: (c) 2015, Rackspace US, Inc.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import re
from voluptuous import ALLOW_EXTRA, PREVENT_EXTRA, All, Any, Length, Invalid, Required, Schema, Self

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