diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 99db46e..28cf4b2 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -56,7 +56,7 @@ jobs: - name: Check code style if: matrix.python-version != '3.6' run: | - poe check-style + poe lint - name: Run tests run: | diff --git a/CHANGES.rst b/CHANGES.rst index 1515d57..6d23c2a 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -6,6 +6,8 @@ pytest-mqtt changelog in progress =========== +- Fix improving error handling when Docker daemon is not running. + 2023-07-28 0.3.0 ================ diff --git a/pyproject.toml b/pyproject.toml index 98edbbb..deaff94 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -141,11 +141,17 @@ line-length = 120 # =================== [tool.poe.tasks] + +check = [ + "lint", + "test", +] + format = [ {cmd="black ."}, {cmd="isort pytest_mqtt testing"}, ] -check-style = [ +lint = [ {cmd="ruff ."}, {cmd="black --check ."}, {cmd="isort --check pytest_mqtt testing"}, diff --git a/pytest_mqtt/mosquitto.py b/pytest_mqtt/mosquitto.py index 9349df9..6726924 100644 --- a/pytest_mqtt/mosquitto.py +++ b/pytest_mqtt/mosquitto.py @@ -55,8 +55,11 @@ def pull_image(self): docker_client.images.pull(image_name) def run(self): - docker_client = docker.from_env(version=self.docker_version) - docker_url = docker_client.api.base_url + try: + docker_client = docker.from_env(version=self.docker_version) + docker_url = docker_client.api.base_url + except Exception: + raise ConnectionError("Cannot connect to the Docker daemon. Is the docker daemon running?") try: docker_client.ping() except Exception: