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
10 changes: 10 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
Change Log
==========

0.7.0 (2026-07-01)
------------------

- Drop support for Python < 3.9.
- Add support for Python 3.12 and pytest >= 8.
- Require docker >= 7.0.0 and pluggy >= 1.0.0; remove urllib3 < 2 pin.
- Replace deprecated ``inspect.getcallargs`` with ``inspect.Signature.bind``.
- Switch build backend from setuptools to poetry-core.
- Add ``container_env`` parameter to ``LocalstackSession``.

0.6.1 (2023-06-06)
------------------

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ clean: ## remove all build, test, coverage and Python artifacts
lint: $(INSTALL_STAMP) ## check code style
$(POETRY) run isort --check-only ./tests/ $(NAME)
$(POETRY) run black --check ./tests/ $(NAME) --diff
$(POETRY) run pflake8 ./tests/ $(NAME)
$(POETRY) run flake8 ./tests/ $(NAME)
$(POETRY) run mypy ./tests/ $(NAME) --ignore-missing-imports
$(POETRY) run bandit -r $(NAME) -s B608

Expand Down
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ via a Localstack_ Docker container.

**Requires:**

- pytest >= 3.3.0
- pytest >= 7
- Docker

Tested against Python >= 3.6.
Tested against Python >= 3.9.

.. _pytest: http://docs.pytest.org/
.. _AWS: https://aws.amazon.com/
Expand Down
1,623 changes: 796 additions & 827 deletions poetry.lock

Large diffs are not rendered by default.

45 changes: 23 additions & 22 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "pytest-localstack"
version = "0.6.1"
version = "0.7.0"
description = "Pytest plugin for AWS integration tests"
authors = ["Mintel Group Ltd."]
license = "MIT"
Expand All @@ -15,9 +15,10 @@ classifiers = [
"License :: OSI Approved :: MIT License",
"Operating System :: POSIX",
"Operating System :: Unix",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3",
"Programming Language :: Python",
"Topic :: Software Development :: Libraries",
Expand All @@ -30,31 +31,31 @@ include = ["CHANGELOG.rst", "LICENSE"]
localstack = "pytest_localstack"

[tool.poetry.dependencies]
python = "^3.7.0"
python = "^3.9"
botocore = "!=1.4.45"
urllib3 = "<2" # https://github.com/orgs/python-poetry/discussions/7937#discussioncomment-5921842
docker = "^6.0.0"
pluggy = "^0.12.0"
pytest = "^6.0.0" # need caplog (+ warnings for tests)
docker = ">=7.0.0"
pluggy = ">=1.0.0"
pytest = ">=7"

[tool.poetry.dev-dependencies]
[tool.poetry.group.dev.dependencies]
boto3 = "*"
hypothesis = "*"
black = "*"
isort = "^5.8.0"
mypy = "^0.812"
flake8 = "^3.9.2"
bandit = "^1.7.0"
pyproject-flake8 = "^0.0.1-alpha.2"
coverage = {extras = ["toml"], version = "^5.5"}
codecov = "^2.1.11"
pytest-cov = "^2.12.1"
pytest-xdist = "^2.2.1"
Sphinx = "^4.0.2"
isort = ">=5.8.0"
mypy = ">=1.0"
flake8 = ">=6.0"
bandit = ">=1.7.5"
pyyaml = ">=6.0.1"
coverage = {extras = ["toml"], version = ">=7.0"}
codecov = ">=2.1.11"
pytest-cov = ">=4.0"
pytest-xdist = ">=3.0"
Sphinx = ">=4.0.2"
flake8-pyproject = "^1.2.4"

[build-system]
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta:__legacy__"
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

[tool.pytest.ini_options]
norecursedirs = ".* build dist *.egg tmp*"
Expand Down
5 changes: 4 additions & 1 deletion pytest_localstack/contrib/botocore.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,10 @@ def create_client(self, *args, **kwargs):
"""Create a botocore client."""
# Localstack doesn't use the virtual host addressing style.
config = botocore.config.Config(s3={"addressing_style": "path"})
callargs = inspect.getcallargs(_original_create_client, self, *args, **kwargs)
sig = inspect.signature(inspect.unwrap(_original_create_client))
bound = sig.bind(self, *args, **kwargs)
bound.apply_defaults()
callargs = bound.arguments
if callargs.get("config"):
config = callargs["config"].merge(config)
callargs["config"] = config
Expand Down
7 changes: 7 additions & 0 deletions pytest_localstack/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,10 @@ class LocalstackSession(RunningSession):
container. Defaults to a randomly generated id.
use_ssl (bool, optional): If True use SSL to connect to Localstack.
Default is False.
container_env (dict, optional): A dictionary of environment variables
which will be set in the Localstack container. see
https://docs.localstack.cloud/references/configuration/ for useful
settings.
**kwargs: Additional kwargs will be stored in a `kwargs` attribute
in case test resource factories want to access them.

Expand All @@ -248,6 +252,7 @@ def __init__(
container_name=None,
use_ssl=False,
hostname=None,
container_env=None,
**kwargs,
):
self._container = None
Expand All @@ -273,6 +278,7 @@ def __init__(
self.container_log_level = container_log_level
self.localstack_version = localstack_version
self.container_name = container_name or generate_container_name()
self.container_env = container_env or {}

def start(self, timeout=60):
"""Start the Localstack container.
Expand Down Expand Up @@ -318,6 +324,7 @@ def start(self, timeout=60):
"KINESIS_ERROR_PROBABILITY": kinesis_error_probability,
"DYNAMODB_ERROR_PROBABILITY": dynamodb_error_probability,
"USE_SSL": use_ssl,
**self.container_env,
},
ports={port: None for port in self.services.values()},
)
Expand Down