Skip to content

Commit

Permalink
Override docker host with env variable (#192)
Browse files Browse the repository at this point in the history
* Add ability to redefine docker url with env variable

* Inline

* Add changelog + bump version

---------

Co-authored-by: Iurii Pliner <[email protected]>
  • Loading branch information
SlivTime and Pliner authored Apr 3, 2024
1 parent fc02877 commit 365db9f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## v0.0.17 (2024-04-03)

* Override docker host with env variable


## v0.0.15 (2023-05-04)

* Pin version of `urllib3` ([see for more details](https://github.com/docker/docker-py/issues/3113))
Expand Down
2 changes: 1 addition & 1 deletion pytest_pg/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

__all__: Tuple[str, ...] = ("PG", "run_pg", "pg", "pg_11", "pg_12", "pg_13", "pg_14", "pg_15", "pg_16")

__version__ = "0.0.16"
__version__ = "0.0.17"

version = f"{__version__}, Python {sys.version}"

Expand Down
4 changes: 2 additions & 2 deletions pytest_pg/fixtures.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import contextlib
import dataclasses
import os
import time
import uuid
from typing import Generator
Expand All @@ -10,7 +11,6 @@
from .utils import find_unused_local_port, is_pg_ready

LOCALHOST = "127.0.0.1"

DEFAULT_PG_USER = "postgres"
DEFAULT_PG_PASSWORD = "mysecretpassword"
DEFAULT_PG_DATABASE = "postgres"
Expand All @@ -27,7 +27,7 @@ class PG:

@contextlib.contextmanager
def run_pg(image: str, ready_timeout: float = 30.0) -> Generator[PG, None, None]:
docker_client = docker.APIClient(version="auto")
docker_client = docker.APIClient(base_url=os.getenv("DOCKER_HOST"), version="auto")

docker_client.pull(image)

Expand Down

0 comments on commit 365db9f

Please sign in to comment.