Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 4 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[tool.poetry]

Check failure on line 1 in pyproject.toml

View check run for this annotation

OX Security / ox-security/scan

psycopg@3.3.9 • Unapproved license (LGPL-3.0-or-later)

Please look at an alternative dependency for psycopg@3.3.9 that utilizes a company approved license.
name = "yellowbox"
version = "0.11.2"
description = ""
Expand All @@ -19,7 +19,8 @@
# 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 }
Expand Down Expand Up @@ -55,7 +56,7 @@
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"
Expand Down Expand Up @@ -121,6 +122,7 @@
"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
Expand Down
5 changes: 4 additions & 1 deletion tests/extras/test_aerospike.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
11 changes: 6 additions & 5 deletions tests/extras/test_rabbit.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -50,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)
Expand Down Expand Up @@ -98,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)
Expand All @@ -107,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()
Expand All @@ -116,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)
3 changes: 2 additions & 1 deletion yellowbox/extras/logstash.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
2 changes: 1 addition & 1 deletion yellowbox/extras/sql_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
6 changes: 3 additions & 3 deletions yellowbox/extras/webserver/http_request_capture.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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):
Expand Down
Loading