Skip to content

Commit

Permalink
chore(codestyle): switch to ruff from black for code formatting (#…
Browse files Browse the repository at this point in the history
…529)

Changed pre-commit config. Some files became re-formatted.
  • Loading branch information
max-pfeiffer authored Apr 5, 2024
1 parent d5b8553 commit 9a89748
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 17 deletions.
10 changes: 3 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,14 @@ repos:
- id: trailing-whitespace
- id: end-of-file-fixer

- repo: https://github.com/psf/black-pre-commit-mirror
rev: '24.2.0'
hooks:
- id: black
args: [ '--config', 'pyproject.toml' ]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: 'v0.3.0'
rev: 'v0.3.5'
hooks:
- id: ruff
# Explicitly setting config to prevent Ruff from using `pyproject.toml` in sub packages.
args: [ '--fix', '--exit-non-zero-on-fix', '--config', 'pyproject.toml' ]
- id: ruff-format
args: [ '--config', 'pyproject.toml' ]

# - repo: local
# hooks:
Expand Down
1 change: 0 additions & 1 deletion core/testcontainers/core/docker_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@


def _wrapped_container_collection(function: Callable[_P, _T]) -> Callable[_P, _T]:

@ft.wraps(ContainerCollection.run)
def wrapper(*args: _P.args, **kwargs: _P.kwargs) -> _T:
return function(*args, **kwargs)
Expand Down
1 change: 1 addition & 0 deletions modules/influxdb/testcontainers/influxdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
- because the InfluxDB clients are different for 1.x and 2.x versions,
so you won't have to install dependencies that you do not need
"""

from typing import Optional

from requests import get
Expand Down
2 changes: 1 addition & 1 deletion modules/mongodb/testcontainers/mongodb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def __init__(
username: Optional[str] = None,
password: Optional[str] = None,
dbname: Optional[str] = None,
**kwargs
**kwargs,
) -> None:
raise_for_deprecated_parameter(kwargs, "port_to_expose", "port")
super().__init__(image=image, **kwargs)
Expand Down
2 changes: 1 addition & 1 deletion modules/mssql/testcontainers/mssql/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def __init__(
port: int = 1433,
dbname: str = "tempdb",
dialect: str = "mssql+pymssql",
**kwargs
**kwargs,
) -> None:
raise_for_deprecated_parameter(kwargs, "user", "username")
super().__init__(image, **kwargs)
Expand Down
2 changes: 1 addition & 1 deletion modules/mysql/testcontainers/mysql/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def __init__(
password: Optional[str] = None,
dbname: Optional[str] = None,
port: int = 3306,
**kwargs
**kwargs,
) -> None:
raise_for_deprecated_parameter(kwargs, "MYSQL_USER", "username")
raise_for_deprecated_parameter(kwargs, "MYSQL_ROOT_PASSWORD", "root_password")
Expand Down
7 changes: 4 additions & 3 deletions modules/mysql/tests/test_mysql.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@ def test_docker_run_mariadb():


def test_docker_env_variables():
with mock.patch.dict("os.environ", MYSQL_USER="demo", MYSQL_DATABASE="custom_db"), MySqlContainer(
"mariadb:10.6.5"
).with_bind_ports(3306, 32785).maybe_emulate_amd64() as container:
with (
mock.patch.dict("os.environ", MYSQL_USER="demo", MYSQL_DATABASE="custom_db"),
MySqlContainer("mariadb:10.6.5").with_bind_ports(3306, 32785).maybe_emulate_amd64() as container,
):
url = container.get_connection_url()
pattern = r"mysql\+pymysql:\/\/demo:test@[\w,.]+:(3306|32785)\/custom_db"
assert re.match(pattern, url)
2 changes: 1 addition & 1 deletion modules/opensearch/testcontainers/opensearch/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def __init__(
image: str = "opensearchproject/opensearch:2.4.0",
port: int = 9200,
security_enabled: bool = False,
**kwargs
**kwargs,
) -> None:
"""
Args:
Expand Down
2 changes: 1 addition & 1 deletion modules/oracle-free/testcontainers/oracle/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def __init__(
password: Optional[str] = None,
port: int = 1521,
dbname: Optional[str] = None,
**kwargs
**kwargs,
) -> None:
super().__init__(image=image, **kwargs)

Expand Down
2 changes: 1 addition & 1 deletion modules/rabbitmq/testcontainers/rabbitmq/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def __init__(
port: Optional[int] = None,
username: Optional[str] = None,
password: Optional[str] = None,
**kwargs
**kwargs,
) -> None:
"""Initialize the RabbitMQ test container.
Expand Down

0 comments on commit 9a89748

Please sign in to comment.