From 184e928304ce64e41f76111046d81ce2565bd5da Mon Sep 17 00:00:00 2001 From: salamzid Date: Thu, 8 Oct 2026 01:02:06 +0300 Subject: [PATCH 1/9] Test Yellowbox on Python 3.15 in CI. setup-python v7 with allow-prereleases is required while 3.15 is still a prerelease. Co-authored-by: Cursor --- .github/workflows/test.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e3b3286..6522727 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,14 +12,15 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ['3.10', '3.11', '3.12', '3.13', '3.14'] + python-version: ['3.10', '3.11', '3.12', '3.13', '3.14', '3.15'] fail-fast: false steps: - uses: actions/checkout@v2 - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v7 with: python-version: ${{ matrix.python-version }} + allow-prereleases: true - name: Install PIP run: | python -m pip install --upgrade pip From 5b0ba6c35716ae44b5d9cb9eedca6336c2bb3feb Mon Sep 17 00:00:00 2001 From: salamzid Date: Thu, 8 Oct 2026 01:21:23 +0300 Subject: [PATCH 2/9] Forward lint.sh arguments to ruff check. This lets scripts/lint.sh --fix apply ruff's safe fixes. Co-authored-by: Cursor --- scripts/lint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/lint.sh b/scripts/lint.sh index 6985f8b..ccc682e 100755 --- a/scripts/lint.sh +++ b/scripts/lint.sh @@ -3,6 +3,6 @@ set -e echo "running ruff..." python -m ruff format . --check -python -m ruff check . +python -m ruff check . "$@" echo "running mypy..." python3 -m mypy --show-error-codes yellowbox From e49f3079b3a1c399edaa4aa0a29ed55f100168c6 Mon Sep 17 00:00:00 2001 From: salamzid Date: Thu, 8 Oct 2026 01:44:58 +0300 Subject: [PATCH 3/9] Satisfy the ruff rules that fail CI. Current ruff flags too many positional parameters, None placement in unions, and the logstash thread lambda. Co-authored-by: Cursor --- tests/extras/test_mssql.py | 4 ++-- tests/extras/test_postgres.py | 4 ++-- yellowbox/extras/logstash.py | 6 +++++- yellowbox/extras/sql_base.py | 2 +- yellowbox/extras/webserver/endpoints.py | 1 + .../extras/webserver/http_request_capture.py | 15 +++++++++++---- yellowbox/extras/webserver/request_capture.py | 1 + yellowbox/extras/webserver/ws_request_capture.py | 9 ++++++++- yellowbox/image_build.py | 1 + 9 files changed, 32 insertions(+), 11 deletions(-) diff --git a/tests/extras/test_mssql.py b/tests/extras/test_mssql.py index 0fffec2..3a4febf 100644 --- a/tests/extras/test_mssql.py +++ b/tests/extras/test_mssql.py @@ -183,7 +183,7 @@ def test_alchemy_usage(service, engine): assert vals == [2, 3, 10] -def test_remote_connection_string(service, db, engine, create_and_pull, docker_client, sqlalchemy_version: str): +def test_remote_connection_string(service, db, engine, create_and_pull, docker_client, *, sqlalchemy_version: str): with temp_network(docker_client) as network, connect(network, service) as service_alias: with engine.begin() as connection: connection.execute( @@ -229,7 +229,7 @@ def test_remote_connection_string(service, db, engine, create_and_pull, docker_c assert vals == ["three", "ten"] -def test_remote_connection_string_host(service, db, engine, create_and_pull, docker_client, sqlalchemy_version: str): +def test_remote_connection_string_host(service, db, engine, create_and_pull, docker_client, *, sqlalchemy_version: str): with engine.begin() as connection: connection.execute( text( diff --git a/tests/extras/test_postgres.py b/tests/extras/test_postgres.py index 87a7b9f..9854d52 100644 --- a/tests/extras/test_postgres.py +++ b/tests/extras/test_postgres.py @@ -177,7 +177,7 @@ def test_alchemy_usage(docker_client, engine): assert vals == [2, 3, 10] -def test_remote_connection_string(docker_client, create_and_pull, service, engine, db, sqlalchemy_version: str): +def test_remote_connection_string(docker_client, create_and_pull, service, engine, db, *, sqlalchemy_version: str): with temp_network(docker_client) as network, connect(network, service) as service_alias: with engine.begin() as connection: connection.execute( @@ -217,7 +217,7 @@ def test_remote_connection_string(docker_client, create_and_pull, service, engin assert vals == ["three", "ten"] -def test_remote_connection_string_host(docker_client, create_and_pull, service, engine, db, sqlalchemy_version: str): +def test_remote_connection_string_host(docker_client, create_and_pull, service, engine, db, *, sqlalchemy_version: str): with engine.begin() as connection: connection.execute( text( diff --git a/yellowbox/extras/logstash.py b/yellowbox/extras/logstash.py index 6f71ce4..077617c 100644 --- a/yellowbox/extras/logstash.py +++ b/yellowbox/extras/logstash.py @@ -113,7 +113,11 @@ def __init__(self, port: int = 0) -> None: # Avoiding a cyclic reference. _background = WeakMethod(self._background_thread) - self._thread = threading.Thread(target=lambda: _background()(), daemon=True) + + def run_background() -> None: + _background()() + + self._thread = threading.Thread(target=run_background, daemon=True) self._selector = selectors.DefaultSelector() diff --git a/yellowbox/extras/sql_base.py b/yellowbox/extras/sql_base.py index 105e21b..8660f48 100644 --- a/yellowbox/extras/sql_base.py +++ b/yellowbox/extras/sql_base.py @@ -36,7 +36,7 @@ def local_connection_string( self, dialect: str | AsDefault = as_default, driver: str | AsDefault | None = as_default, - options: ConnectionOptions | None | AsDefault = as_default, + options: ConnectionOptions | AsDefault | None = as_default, ): return self.owner.local_connection_string(dialect, driver, database=self.name, options=options) diff --git a/yellowbox/extras/webserver/endpoints.py b/yellowbox/extras/webserver/endpoints.py index 60a427a..5059dac 100644 --- a/yellowbox/extras/webserver/endpoints.py +++ b/yellowbox/extras/webserver/endpoints.py @@ -68,6 +68,7 @@ def __init__( methods: METHODS, rule_string: str, side_effect: HTTP_SIDE_EFFECT, + *, auto_read_body: bool = True, forbid_implicit_head_verb: bool = True, ): diff --git a/yellowbox/extras/webserver/http_request_capture.py b/yellowbox/extras/webserver/http_request_capture.py index 73251b8..9e10e0d 100644 --- a/yellowbox/extras/webserver/http_request_capture.py +++ b/yellowbox/extras/webserver/http_request_capture.py @@ -128,6 +128,7 @@ def __init__( path: str | Pattern[str] | None = None, path_params: Mapping[str, Any] | None = None, path_params_submap: Mapping[str, Any] | None = None, + *, query_params: Mapping[str, Collection[str]] | None = None, query_params_submap: Mapping[str, Collection[str]] | None = None, method: str | None = None, @@ -135,7 +136,7 @@ def __init__( text: str | None = None, json: Any = _missing, json_submap: Mapping[str, Any] | None = None, - content_predicate: None | (Callable[[bytes], bool] | tuple[Callable[[bytes], Any], Any] | BodyValidator) = None, + content_predicate: Callable[[bytes], bool] | tuple[Callable[[bytes], Any], Any] | BodyValidator | None = None, ): """ Args: @@ -164,7 +165,13 @@ def __init__( provided. Cannot be used alongside other content-testing parameters """ super().__init__( - headers, headers_submap, path, path_params, path_params_submap, query_params, query_params_submap + headers, + headers_submap, + path, + path_params, + path_params_submap, + query_params=query_params, + query_params_submap=query_params_submap, ) if method is None: @@ -338,7 +345,7 @@ def assert_requested_with( text: str | None = None, json: Any = _missing, json_submap: Mapping[str, Any] | None = None, - content_predicate: None | (Callable[[bytes], bool] | tuple[Callable[[bytes], Any], Any] | BodyValidator) = None, + content_predicate: Callable[[bytes], bool] | tuple[Callable[[bytes], Any], Any] | BodyValidator | None = None, ): ... def assert_requested_with(self, expected: ExpectedHTTPRequest | None = None, **kwargs): @@ -426,7 +433,7 @@ def assert_any_request( text: str | None = None, json: Any = _missing, json_submap: Mapping[str, Any] | None = None, - content_predicate: None | (Callable[[bytes], bool] | tuple[Callable[[bytes], Any], Any] | BodyValidator) = None, + content_predicate: Callable[[bytes], bool] | tuple[Callable[[bytes], Any], Any] | BodyValidator | None = None, ): ... def assert_any_request(self, expected: ExpectedHTTPRequest | None = None, **kwargs): diff --git a/yellowbox/extras/webserver/request_capture.py b/yellowbox/extras/webserver/request_capture.py index 7683794..b64213a 100644 --- a/yellowbox/extras/webserver/request_capture.py +++ b/yellowbox/extras/webserver/request_capture.py @@ -170,6 +170,7 @@ def __init__( path: str | Pattern[str] | None = None, path_params: Mapping[str, Any] | None = None, path_params_submap: Mapping[str, Any] | None = None, + *, query_params: Mapping[str, Collection[str]] | None = None, query_params_submap: Mapping[str, Collection[str]] | None = None, ): diff --git a/yellowbox/extras/webserver/ws_request_capture.py b/yellowbox/extras/webserver/ws_request_capture.py index 551d1a4..afe5ea4 100644 --- a/yellowbox/extras/webserver/ws_request_capture.py +++ b/yellowbox/extras/webserver/ws_request_capture.py @@ -234,6 +234,7 @@ def __init__( headers_submap: Mapping[str, Collection[str]] | None = None, path: str | Pattern[str] | None = None, path_params: Mapping[str, Any] | None = None, + *, path_params_submap: Mapping[str, Any] | None = None, query_params: Mapping[str, Collection[str]] | None = None, query_params_submap: Mapping[str, Collection[str]] | None = None, @@ -260,7 +261,13 @@ def __init__( connections (if False) """ super().__init__( - headers, headers_submap, path, path_params, path_params_submap, query_params, query_params_submap + headers, + headers_submap, + path, + path_params, + path_params_submap, + query_params=query_params, + query_params_submap=query_params_submap, ) if messages and messages[0] is ...: messages = messages[1:] diff --git a/yellowbox/image_build.py b/yellowbox/image_build.py index 0baa0a6..d2caf82 100644 --- a/yellowbox/image_build.py +++ b/yellowbox/image_build.py @@ -68,6 +68,7 @@ def build_image( remove_image: bool = True, file: TextIO | None = ..., # type: ignore[assignment] output: TextIO | None = sys.stderr, + *, spinner: bool = True, **kwargs, ): From c1c774c37f173c30511966f6de10322a41d02f27 Mon Sep 17 00:00:00 2001 From: salamzid Date: Thu, 8 Oct 2026 01:50:56 +0300 Subject: [PATCH 4/9] Revert "Satisfy the ruff rules that fail CI." This reverts commit e49f3079b3a1c399edaa4aa0a29ed55f100168c6. --- tests/extras/test_mssql.py | 4 ++-- tests/extras/test_postgres.py | 4 ++-- yellowbox/extras/logstash.py | 6 +----- yellowbox/extras/sql_base.py | 2 +- yellowbox/extras/webserver/endpoints.py | 1 - .../extras/webserver/http_request_capture.py | 15 ++++----------- yellowbox/extras/webserver/request_capture.py | 1 - yellowbox/extras/webserver/ws_request_capture.py | 9 +-------- yellowbox/image_build.py | 1 - 9 files changed, 11 insertions(+), 32 deletions(-) diff --git a/tests/extras/test_mssql.py b/tests/extras/test_mssql.py index 3a4febf..0fffec2 100644 --- a/tests/extras/test_mssql.py +++ b/tests/extras/test_mssql.py @@ -183,7 +183,7 @@ def test_alchemy_usage(service, engine): assert vals == [2, 3, 10] -def test_remote_connection_string(service, db, engine, create_and_pull, docker_client, *, sqlalchemy_version: str): +def test_remote_connection_string(service, db, engine, create_and_pull, docker_client, sqlalchemy_version: str): with temp_network(docker_client) as network, connect(network, service) as service_alias: with engine.begin() as connection: connection.execute( @@ -229,7 +229,7 @@ def test_remote_connection_string(service, db, engine, create_and_pull, docker_c assert vals == ["three", "ten"] -def test_remote_connection_string_host(service, db, engine, create_and_pull, docker_client, *, sqlalchemy_version: str): +def test_remote_connection_string_host(service, db, engine, create_and_pull, docker_client, sqlalchemy_version: str): with engine.begin() as connection: connection.execute( text( diff --git a/tests/extras/test_postgres.py b/tests/extras/test_postgres.py index 9854d52..87a7b9f 100644 --- a/tests/extras/test_postgres.py +++ b/tests/extras/test_postgres.py @@ -177,7 +177,7 @@ def test_alchemy_usage(docker_client, engine): assert vals == [2, 3, 10] -def test_remote_connection_string(docker_client, create_and_pull, service, engine, db, *, sqlalchemy_version: str): +def test_remote_connection_string(docker_client, create_and_pull, service, engine, db, sqlalchemy_version: str): with temp_network(docker_client) as network, connect(network, service) as service_alias: with engine.begin() as connection: connection.execute( @@ -217,7 +217,7 @@ def test_remote_connection_string(docker_client, create_and_pull, service, engin assert vals == ["three", "ten"] -def test_remote_connection_string_host(docker_client, create_and_pull, service, engine, db, *, sqlalchemy_version: str): +def test_remote_connection_string_host(docker_client, create_and_pull, service, engine, db, sqlalchemy_version: str): with engine.begin() as connection: connection.execute( text( diff --git a/yellowbox/extras/logstash.py b/yellowbox/extras/logstash.py index 077617c..6f71ce4 100644 --- a/yellowbox/extras/logstash.py +++ b/yellowbox/extras/logstash.py @@ -113,11 +113,7 @@ def __init__(self, port: int = 0) -> None: # Avoiding a cyclic reference. _background = WeakMethod(self._background_thread) - - def run_background() -> None: - _background()() - - self._thread = threading.Thread(target=run_background, daemon=True) + self._thread = threading.Thread(target=lambda: _background()(), daemon=True) self._selector = selectors.DefaultSelector() diff --git a/yellowbox/extras/sql_base.py b/yellowbox/extras/sql_base.py index 8660f48..105e21b 100644 --- a/yellowbox/extras/sql_base.py +++ b/yellowbox/extras/sql_base.py @@ -36,7 +36,7 @@ def local_connection_string( self, dialect: str | AsDefault = as_default, driver: str | AsDefault | None = as_default, - options: ConnectionOptions | AsDefault | None = as_default, + options: ConnectionOptions | None | AsDefault = as_default, ): return self.owner.local_connection_string(dialect, driver, database=self.name, options=options) diff --git a/yellowbox/extras/webserver/endpoints.py b/yellowbox/extras/webserver/endpoints.py index 5059dac..60a427a 100644 --- a/yellowbox/extras/webserver/endpoints.py +++ b/yellowbox/extras/webserver/endpoints.py @@ -68,7 +68,6 @@ def __init__( methods: METHODS, rule_string: str, side_effect: HTTP_SIDE_EFFECT, - *, auto_read_body: bool = True, forbid_implicit_head_verb: bool = True, ): diff --git a/yellowbox/extras/webserver/http_request_capture.py b/yellowbox/extras/webserver/http_request_capture.py index 9e10e0d..73251b8 100644 --- a/yellowbox/extras/webserver/http_request_capture.py +++ b/yellowbox/extras/webserver/http_request_capture.py @@ -128,7 +128,6 @@ def __init__( path: str | Pattern[str] | None = None, path_params: Mapping[str, Any] | None = None, path_params_submap: Mapping[str, Any] | None = None, - *, query_params: Mapping[str, Collection[str]] | None = None, query_params_submap: Mapping[str, Collection[str]] | None = None, method: str | None = None, @@ -136,7 +135,7 @@ def __init__( text: str | None = None, json: Any = _missing, json_submap: Mapping[str, Any] | None = None, - content_predicate: Callable[[bytes], bool] | tuple[Callable[[bytes], Any], Any] | BodyValidator | None = None, + content_predicate: None | (Callable[[bytes], bool] | tuple[Callable[[bytes], Any], Any] | BodyValidator) = None, ): """ Args: @@ -165,13 +164,7 @@ def __init__( provided. Cannot be used alongside other content-testing parameters """ super().__init__( - headers, - headers_submap, - path, - path_params, - path_params_submap, - query_params=query_params, - query_params_submap=query_params_submap, + headers, headers_submap, path, path_params, path_params_submap, query_params, query_params_submap ) if method is None: @@ -345,7 +338,7 @@ def assert_requested_with( text: str | None = None, json: Any = _missing, json_submap: Mapping[str, Any] | None = None, - content_predicate: Callable[[bytes], bool] | tuple[Callable[[bytes], Any], Any] | BodyValidator | None = None, + content_predicate: None | (Callable[[bytes], bool] | tuple[Callable[[bytes], Any], Any] | BodyValidator) = None, ): ... def assert_requested_with(self, expected: ExpectedHTTPRequest | None = None, **kwargs): @@ -433,7 +426,7 @@ def assert_any_request( text: str | None = None, json: Any = _missing, json_submap: Mapping[str, Any] | None = None, - content_predicate: Callable[[bytes], bool] | tuple[Callable[[bytes], Any], Any] | BodyValidator | None = None, + content_predicate: None | (Callable[[bytes], bool] | tuple[Callable[[bytes], Any], Any] | BodyValidator) = None, ): ... def assert_any_request(self, expected: ExpectedHTTPRequest | None = None, **kwargs): diff --git a/yellowbox/extras/webserver/request_capture.py b/yellowbox/extras/webserver/request_capture.py index b64213a..7683794 100644 --- a/yellowbox/extras/webserver/request_capture.py +++ b/yellowbox/extras/webserver/request_capture.py @@ -170,7 +170,6 @@ def __init__( path: str | Pattern[str] | None = None, path_params: Mapping[str, Any] | None = None, path_params_submap: Mapping[str, Any] | None = None, - *, query_params: Mapping[str, Collection[str]] | None = None, query_params_submap: Mapping[str, Collection[str]] | None = None, ): diff --git a/yellowbox/extras/webserver/ws_request_capture.py b/yellowbox/extras/webserver/ws_request_capture.py index afe5ea4..551d1a4 100644 --- a/yellowbox/extras/webserver/ws_request_capture.py +++ b/yellowbox/extras/webserver/ws_request_capture.py @@ -234,7 +234,6 @@ def __init__( headers_submap: Mapping[str, Collection[str]] | None = None, path: str | Pattern[str] | None = None, path_params: Mapping[str, Any] | None = None, - *, path_params_submap: Mapping[str, Any] | None = None, query_params: Mapping[str, Collection[str]] | None = None, query_params_submap: Mapping[str, Collection[str]] | None = None, @@ -261,13 +260,7 @@ def __init__( connections (if False) """ super().__init__( - headers, - headers_submap, - path, - path_params, - path_params_submap, - query_params=query_params, - query_params_submap=query_params_submap, + headers, headers_submap, path, path_params, path_params_submap, query_params, query_params_submap ) if messages and messages[0] is ...: messages = messages[1:] diff --git a/yellowbox/image_build.py b/yellowbox/image_build.py index d2caf82..0baa0a6 100644 --- a/yellowbox/image_build.py +++ b/yellowbox/image_build.py @@ -68,7 +68,6 @@ def build_image( remove_image: bool = True, file: TextIO | None = ..., # type: ignore[assignment] output: TextIO | None = sys.stderr, - *, spinner: bool = True, **kwargs, ): From 8a0fc4eae1bfc02143d83902bacf12faa46916d8 Mon Sep 17 00:00:00 2001 From: salamzid Date: Thu, 8 Oct 2026 01:50:56 +0300 Subject: [PATCH 5/9] Revert "Forward lint.sh arguments to ruff check." This reverts commit 5b0ba6c35716ae44b5d9cb9eedca6336c2bb3feb. --- scripts/lint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/lint.sh b/scripts/lint.sh index ccc682e..6985f8b 100755 --- a/scripts/lint.sh +++ b/scripts/lint.sh @@ -3,6 +3,6 @@ set -e echo "running ruff..." python -m ruff format . --check -python -m ruff check . "$@" +python -m ruff check . echo "running mypy..." python3 -m mypy --show-error-codes yellowbox From 4c19a943cf0528b3587017c47cf1a8ba5b04e726 Mon Sep 17 00:00:00 2001 From: salamzid Date: Sun, 22 Nov 2026 13:33:32 +0200 Subject: [PATCH 6/9] Fix ruff lint failures with current ruff. Ignore PLR0917 (consistent with PLR0913), move None to the end of unions (RUF036), and keep the logstash weakref lambda with a noqa. Co-authored-by: Cursor --- pyproject.toml | 1 + yellowbox/extras/logstash.py | 3 ++- yellowbox/extras/sql_base.py | 2 +- yellowbox/extras/webserver/http_request_capture.py | 6 +++--- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 9c0f63d..739ef0c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -121,6 +121,7 @@ ignore = [ "COM812", # trailing comma, handled by black "PLR2004", # Magic value used in comparison "PLR0913", # Too many arguments to function call + "PLR0917", # Too many positional arguments (public signatures, same rationale as PLR0913) "PLR0912", # too many branches "PLR0911", # Too many return statements "PLR0915", # too many statements diff --git a/yellowbox/extras/logstash.py b/yellowbox/extras/logstash.py index 6f71ce4..6e4ae63 100644 --- a/yellowbox/extras/logstash.py +++ b/yellowbox/extras/logstash.py @@ -113,7 +113,8 @@ def __init__(self, port: int = 0) -> None: # Avoiding a cyclic reference. _background = WeakMethod(self._background_thread) - self._thread = threading.Thread(target=lambda: _background()(), daemon=True) + # the lambda defers dereferencing the weakref until the thread runs + self._thread = threading.Thread(target=lambda: _background()(), daemon=True) # noqa: PLW0108 self._selector = selectors.DefaultSelector() diff --git a/yellowbox/extras/sql_base.py b/yellowbox/extras/sql_base.py index 105e21b..8660f48 100644 --- a/yellowbox/extras/sql_base.py +++ b/yellowbox/extras/sql_base.py @@ -36,7 +36,7 @@ def local_connection_string( self, dialect: str | AsDefault = as_default, driver: str | AsDefault | None = as_default, - options: ConnectionOptions | None | AsDefault = as_default, + options: ConnectionOptions | AsDefault | None = as_default, ): return self.owner.local_connection_string(dialect, driver, database=self.name, options=options) diff --git a/yellowbox/extras/webserver/http_request_capture.py b/yellowbox/extras/webserver/http_request_capture.py index 73251b8..4f9f237 100644 --- a/yellowbox/extras/webserver/http_request_capture.py +++ b/yellowbox/extras/webserver/http_request_capture.py @@ -135,7 +135,7 @@ def __init__( text: str | None = None, json: Any = _missing, json_submap: Mapping[str, Any] | None = None, - content_predicate: None | (Callable[[bytes], bool] | tuple[Callable[[bytes], Any], Any] | BodyValidator) = None, + content_predicate: (Callable[[bytes], bool] | tuple[Callable[[bytes], Any], Any] | BodyValidator) | None = None, ): """ Args: @@ -338,7 +338,7 @@ def assert_requested_with( text: str | None = None, json: Any = _missing, json_submap: Mapping[str, Any] | None = None, - content_predicate: None | (Callable[[bytes], bool] | tuple[Callable[[bytes], Any], Any] | BodyValidator) = None, + content_predicate: (Callable[[bytes], bool] | tuple[Callable[[bytes], Any], Any] | BodyValidator) | None = None, ): ... def assert_requested_with(self, expected: ExpectedHTTPRequest | None = None, **kwargs): @@ -426,7 +426,7 @@ def assert_any_request( text: str | None = None, json: Any = _missing, json_submap: Mapping[str, Any] | None = None, - content_predicate: None | (Callable[[bytes], bool] | tuple[Callable[[bytes], Any], Any] | BodyValidator) = None, + content_predicate: (Callable[[bytes], bool] | tuple[Callable[[bytes], Any], Any] | BodyValidator) | None = None, ): ... def assert_any_request(self, expected: ExpectedHTTPRequest | None = None, **kwargs): From 2293cba1d3ee0525e51e02a208b443df7dd0d7af Mon Sep 17 00:00:00 2001 From: salamzid Date: Sun, 22 Nov 2026 13:39:16 +0200 Subject: [PATCH 7/9] Make CI work on python 3.15 and with current pytest. Skip the aerospike extra on 3.15 (no wheel, sdist fails to build) and skip its tests when the client is missing. Upgrade pytest-xdist to v3, since v2 imports py.log. Co-authored-by: Cursor --- CHANGELOG.md | 4 ++++ pyproject.toml | 5 +++-- tests/extras/test_aerospike.py | 5 ++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e8c103..3685e1d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ # Yellowbox Changelog ## NEXT +### Added +* added tests for python 3.15 (the `aerospike` extra is not installed on 3.15 until a compatible client is released) ### Internal +* upgraded pytest-xdist to v3 +* fixed lint errors from newer ruff versions * remove flakeyness around image building by building images with unique names ## 0.11.2 ### Fixed diff --git a/pyproject.toml b/pyproject.toml index 739ef0c..7aa769b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -19,7 +19,8 @@ pika = { version = "*", optional = true } # python 3.11 and lower use kafka-python, 3.12 and higher use confluent-kafka kafka-python = { version = "*", optional = true, python="<3.12" } confluent-kafka = { version = "*", optional = true, python=">=3.12" } -aerospike = { version = ">=10.0.1", optional = true } +# no cp315 wheel yet, and the sdist fails to build on python 3.15 +aerospike = { version = ">=10.0.1", optional = true, python = "<3.15" } # note that any version between 12.7.0 and 12.11.0 will not work azure-storage-blob = { version = ">=12.0.0", optional = true } @@ -55,7 +56,7 @@ websocket_client = "*" mypy = {version=">=1"} types-requests = "^2.25.0" types-redis = "^3.5.4" -pytest-xdist = "^2.1.0" +pytest-xdist = "^3.0.0" sphinx = {version="^6.1.3", python=">=3.12"} furo = {version="*", python=">=3.12"} pytest-asyncio = "^0.18.2" diff --git a/tests/extras/test_aerospike.py b/tests/extras/test_aerospike.py index c7ea3b7..1a5ecd5 100644 --- a/tests/extras/test_aerospike.py +++ b/tests/extras/test_aerospike.py @@ -1,4 +1,7 @@ -from pytest import fixture, mark +from pytest import fixture, importorskip, mark + +# the aerospike client is not installable on python 3.15 yet +importorskip("aerospike") from yellowbox.extras.aerospike import AerospikeService From e3684bb17d64a1507970273b5c4a7d19c612b21d Mon Sep 17 00:00:00 2001 From: salamzid Date: Sun, 22 Nov 2026 14:23:59 +0200 Subject: [PATCH 8/9] Declare the rabbit async test queue as durable. Current RabbitMQ rejects transient non-exclusive queues by default. Co-authored-by: Cursor --- tests/extras/test_rabbit.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/extras/test_rabbit.py b/tests/extras/test_rabbit.py index 8ba9906..a993d55 100644 --- a/tests/extras/test_rabbit.py +++ b/tests/extras/test_rabbit.py @@ -24,7 +24,8 @@ async def test_connection_works_async(docker_client): connection: BlockingConnection with rabbit.connection() as connection: channel = connection.channel() - channel.queue_declare("routing") + # recent RabbitMQ versions reject transient non-exclusive queues, so the queue must be durable + channel.queue_declare("routing", durable=True) channel.basic_publish("", "routing", body=b"hi there") sleep(1) From 7b8c535c72ca3b238ce965d5ba3b74e66ebef8c1 Mon Sep 17 00:00:00 2001 From: salamzid Date: Sun, 22 Nov 2026 14:33:40 +0200 Subject: [PATCH 9/9] Declare all rabbit test queues as durable. Co-authored-by: Cursor --- tests/extras/test_rabbit.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/extras/test_rabbit.py b/tests/extras/test_rabbit.py index a993d55..8b4961a 100644 --- a/tests/extras/test_rabbit.py +++ b/tests/extras/test_rabbit.py @@ -51,7 +51,7 @@ def test_connection_works(docker_client, rabbit, q_name): connection: BlockingConnection with rabbit.connection() as connection: channel = connection.channel() - channel.queue_declare(q_name) + channel.queue_declare(q_name, durable=True) channel.basic_publish("", q_name, body=b"hi there") sleep(1) @@ -99,7 +99,7 @@ def assert_no_queues(rabbit: RabbitMQService): def test_reset_state(docker_client, rabbit, q_name): with rabbit.connection() as connection: channel = connection.channel() - channel.queue_declare(q_name) + channel.queue_declare(q_name, durable=True) channel.basic_consume(q_name, lambda: 1 / 0) # no-op rabbit.reset_state() assert_no_queues(rabbit) @@ -108,7 +108,7 @@ def test_reset_state(docker_client, rabbit, q_name): def test_reset_state_bad(docker_client, rabbit, q_name): with rabbit.connection() as connection: channel = connection.channel() - channel.queue_declare(q_name) + channel.queue_declare(q_name, durable=True) channel.basic_consume(q_name, lambda: 1 / 0) # no-op with raises(requests.HTTPError): rabbit.reset_state() @@ -117,7 +117,7 @@ def test_reset_state_bad(docker_client, rabbit, q_name): def test_reset_state_force(docker_client, rabbit, q_name): with rabbit.connection() as connection: channel = connection.channel() - channel.queue_declare(q_name) + channel.queue_declare(q_name, durable=True) channel.basic_consume(q_name, lambda: 1 / 0) # no-op rabbit.reset_state(force_queue_deletion=True) assert_no_queues(rabbit)