summaryrefslogtreecommitdiff
path: root/test/lib/ansible_test/_internal/util.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/lib/ansible_test/_internal/util.py')
-rw-r--r--test/lib/ansible_test/_internal/util.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/lib/ansible_test/_internal/util.py b/test/lib/ansible_test/_internal/util.py
index ec485a2bcf..53959d41a2 100644
--- a/test/lib/ansible_test/_internal/util.py
+++ b/test/lib/ansible_test/_internal/util.py
@@ -129,6 +129,7 @@ class Architecture:
Normalized architecture names.
These are the architectures supported by ansible-test, such as when provisioning remote instances.
"""
+
X86_64 = 'x86_64'
AARCH64 = 'aarch64'
@@ -553,6 +554,7 @@ def communicate_with_process(
class WriterThread(WrappedThread):
"""Thread to write data to stdin of a subprocess."""
+
def __init__(self, handle: t.IO[bytes], data: bytes) -> None:
super().__init__(self._run)
@@ -570,6 +572,7 @@ class WriterThread(WrappedThread):
class ReaderThread(WrappedThread, metaclass=abc.ABCMeta):
"""Thread to read stdout from a subprocess."""
+
def __init__(self, handle: t.IO[bytes], buffer: t.BinaryIO) -> None:
super().__init__(self._run)
@@ -584,6 +587,7 @@ class ReaderThread(WrappedThread, metaclass=abc.ABCMeta):
class CaptureThread(ReaderThread):
"""Thread to capture stdout from a subprocess into a buffer."""
+
def _run(self) -> None:
"""Workload to run on a thread."""
src = self.handle
@@ -598,6 +602,7 @@ class CaptureThread(ReaderThread):
class OutputThread(ReaderThread):
"""Thread to pass stdout from a subprocess to stdout."""
+
def _run(self) -> None:
"""Workload to run on a thread."""
src = self.handle
@@ -778,6 +783,7 @@ def generate_password() -> str:
class Display:
"""Manages color console output."""
+
clear = '\033[0m'
red = '\033[31m'
green = '\033[32m'
@@ -886,6 +892,7 @@ class Display:
class InternalError(Exception):
"""An unhandled internal error indicating a bug in the code."""
+
def __init__(self, message: str) -> None:
super().__init__(f'An internal error has occurred in ansible-test: {message}')
@@ -900,6 +907,7 @@ class ApplicationWarning(Exception):
class SubprocessError(ApplicationError):
"""Error resulting from failed subprocess execution."""
+
def __init__(
self,
cmd: list[str],
@@ -936,6 +944,7 @@ class SubprocessError(ApplicationError):
class MissingEnvironmentVariable(ApplicationError):
"""Error caused by missing environment variable."""
+
def __init__(self, name: str) -> None:
super().__init__('Missing environment variable: %s' % name)
@@ -948,6 +957,7 @@ class HostConnectionError(ApplicationError):
Raised by provisioning code when one or more provisioning threads raise this exception.
Also raised when an SSH connection fails for the shell command.
"""
+
def __init__(self, message: str, callback: t.Callable[[], None] = None) -> None:
super().__init__(message)