diff --git a/.github/scripts/get_latest_changelog.py b/.github/scripts/get_latest_changelog.py index c6a7d33c..83e0807d 100644 --- a/.github/scripts/get_latest_changelog.py +++ b/.github/scripts/get_latest_changelog.py @@ -29,6 +29,7 @@ ``` """ + import re h2 = r"^##\s.*$" diff --git a/hatch_version_hook.py b/hatch_version_hook.py index d5dc7922..63787a59 100644 --- a/hatch_version_hook.py +++ b/hatch_version_hook.py @@ -7,7 +7,6 @@ from hatchling.builders.hooks.plugin.interface import BuildHookInterface from typing import Any, Optional - _logger = logging.Logger(__name__, logging.INFO) _stdout_handler = logging.StreamHandler(sys.stdout) _stdout_handler.addFilter(lambda record: record.levelno <= logging.INFO) diff --git a/requirements-testing.txt b/requirements-testing.txt index 433a7699..62670fa9 100644 --- a/requirements-testing.txt +++ b/requirements-testing.txt @@ -1,12 +1,14 @@ coverage[toml] == 7.* coverage-conditional-plugin == 0.9.0 -pytest == 9.0.*; python_version >= '3.10' +pytest == 9.1.*; python_version >= '3.10' pytest == 8.4.*; python_version < '3.10' pytest-cov == 7.1.* pytest-timeout == 2.4.* pytest-xdist == 3.8.* -black == 25.* +black == 26.*; python_version >= '3.10' +black == 25.*; python_version < '3.10' ruff == 0.15.* -mypy == 1.19.* +mypy == 2.1.*; python_version >= '3.10' +mypy == 1.19.*; python_version < '3.10' psutil == 7.2.* types-PyYAML ~= 6.0 diff --git a/src/openjd/adaptor_runtime/_background/backend_named_pipe_server.py b/src/openjd/adaptor_runtime/_background/backend_named_pipe_server.py index 2b7c9c7d..830731da 100644 --- a/src/openjd/adaptor_runtime/_background/backend_named_pipe_server.py +++ b/src/openjd/adaptor_runtime/_background/backend_named_pipe_server.py @@ -17,7 +17,6 @@ from ..adaptors import AdaptorRunner from .log_buffers import LogBuffer - _logger = logging.getLogger(__name__) diff --git a/src/openjd/adaptor_runtime/_named_pipe/named_pipe_request_handler.py b/src/openjd/adaptor_runtime/_named_pipe/named_pipe_request_handler.py index 742850d8..cfb0b413 100644 --- a/src/openjd/adaptor_runtime/_named_pipe/named_pipe_request_handler.py +++ b/src/openjd/adaptor_runtime/_named_pipe/named_pipe_request_handler.py @@ -20,7 +20,6 @@ from openjd.adaptor_runtime._osname import OSName - _logger = logging.getLogger(__name__) diff --git a/src/openjd/adaptor_runtime/_named_pipe/named_pipe_server.py b/src/openjd/adaptor_runtime/_named_pipe/named_pipe_server.py index 5ba430a4..3e58ccb8 100644 --- a/src/openjd/adaptor_runtime/_named_pipe/named_pipe_server.py +++ b/src/openjd/adaptor_runtime/_named_pipe/named_pipe_server.py @@ -32,7 +32,6 @@ from abc import ABC, abstractmethod - _logger = logging.getLogger(__name__) diff --git a/src/openjd/adaptor_runtime/adaptors/_validator.py b/src/openjd/adaptor_runtime/adaptors/_validator.py index 7f292e49..d94d9938 100644 --- a/src/openjd/adaptor_runtime/adaptors/_validator.py +++ b/src/openjd/adaptor_runtime/adaptors/_validator.py @@ -9,7 +9,6 @@ import yaml from typing import Any - _logger = logging.getLogger(__name__) diff --git a/src/openjd/adaptor_runtime/process/_logging_subprocess.py b/src/openjd/adaptor_runtime/process/_logging_subprocess.py index efabd5ab..0073c263 100644 --- a/src/openjd/adaptor_runtime/process/_logging_subprocess.py +++ b/src/openjd/adaptor_runtime/process/_logging_subprocess.py @@ -1,6 +1,7 @@ # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. """Module for the LoggingSubprocess class""" + from __future__ import annotations import logging diff --git a/src/openjd/adaptor_runtime/process/_managed_process.py b/src/openjd/adaptor_runtime/process/_managed_process.py index b27b79e9..cc4554ec 100644 --- a/src/openjd/adaptor_runtime/process/_managed_process.py +++ b/src/openjd/adaptor_runtime/process/_managed_process.py @@ -1,6 +1,7 @@ # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. """Module for the ManagedProcess class""" + from __future__ import annotations from abc import ABC as ABC, abstractmethod diff --git a/src/openjd/adaptor_runtime/process/_stream_logger.py b/src/openjd/adaptor_runtime/process/_stream_logger.py index 86271062..5914e0e3 100644 --- a/src/openjd/adaptor_runtime/process/_stream_logger.py +++ b/src/openjd/adaptor_runtime/process/_stream_logger.py @@ -1,6 +1,7 @@ # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. """Module for the StreamLogger class""" + from __future__ import annotations import logging diff --git a/src/openjd/adaptor_runtime_client/posix_client_interface.py b/src/openjd/adaptor_runtime_client/posix_client_interface.py index 91a51434..46f61f72 100644 --- a/src/openjd/adaptor_runtime_client/posix_client_interface.py +++ b/src/openjd/adaptor_runtime_client/posix_client_interface.py @@ -13,7 +13,6 @@ from .connection import UnixHTTPConnection as _UnixHTTPConnection from urllib.parse import urlencode as _urlencode - # Set timeout to None so our requests are blocking calls with no timeout. # See socket.settimeout _REQUEST_TIMEOUT = None diff --git a/test/openjd/adaptor_runtime/unit/process/test_logging_subprocess.py b/test/openjd/adaptor_runtime/unit/process/test_logging_subprocess.py index 87ea6c07..8c81d3aa 100644 --- a/test/openjd/adaptor_runtime/unit/process/test_logging_subprocess.py +++ b/test/openjd/adaptor_runtime/unit/process/test_logging_subprocess.py @@ -1,6 +1,7 @@ # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. """Tests for StreamLogger""" + from __future__ import annotations import signal diff --git a/test/openjd/adaptor_runtime/unit/process/test_stream_logger.py b/test/openjd/adaptor_runtime/unit/process/test_stream_logger.py index 23ee1249..f578b1c0 100644 --- a/test/openjd/adaptor_runtime/unit/process/test_stream_logger.py +++ b/test/openjd/adaptor_runtime/unit/process/test_stream_logger.py @@ -1,6 +1,7 @@ # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. """Tests for LoggingSubprocess""" + from __future__ import annotations import logging diff --git a/test/openjd/adaptor_runtime/unit/test_entrypoint.py b/test/openjd/adaptor_runtime/unit/test_entrypoint.py index d253f4ca..cb226f51 100644 --- a/test/openjd/adaptor_runtime/unit/test_entrypoint.py +++ b/test/openjd/adaptor_runtime/unit/test_entrypoint.py @@ -54,7 +54,11 @@ def mock_logging(): @pytest.fixture(autouse=True) def mock_getLogger(): - with patch.object(runtime_entrypoint.logging, "getLogger"): + # Patch EntryPoint._init_loggers (rather than the global logging.getLogger) + # so EntryPoint does not attach real handlers during tests. Patching + # logging.getLogger globally breaks pytest's caplog fixture on pytest >= 9.1, + # which relies on logging.getLogger to install its log-capture handler. + with patch.object(runtime_entrypoint.EntryPoint, "_init_loggers"): yield