From 16e677e925131974acbd67131124e11301d127b4 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 30 Aug 2020 13:22:57 +0200 Subject: Merging upstream version 2.7.1. Signed-off-by: Daniel Baumann --- testing/util.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'testing/util.py') diff --git a/testing/util.py b/testing/util.py index 4edb7a9..f556a8d 100644 --- a/testing/util.py +++ b/testing/util.py @@ -5,14 +5,24 @@ import subprocess import pytest from pre_commit import parse_shebang -from pre_commit.languages.docker import docker_is_running +from pre_commit.util import CalledProcessError from pre_commit.util import cmd_output +from pre_commit.util import cmd_output_b from testing.auto_namedtuple import auto_namedtuple TESTING_DIR = os.path.abspath(os.path.dirname(__file__)) +def docker_is_running() -> bool: # pragma: win32 no cover + try: + cmd_output_b('docker', 'ps') + except CalledProcessError: # pragma: no cover + return False + else: + return True + + def get_resource_path(path): return os.path.join(TESTING_DIR, 'resources', path) -- cgit v1.2.3