summaryrefslogtreecommitdiffstats
path: root/testing
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2020-08-30 11:22:53 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2020-08-30 11:22:53 +0000
commit6cfa8e0963e9a518a25528a248932fcf41b4f969 (patch)
tree6882a2a7a3214ef85d7a946f2506e9ed2c3f60f5 /testing
parentAdding upstream version 2.6.0. (diff)
downloadpre-commit-6cfa8e0963e9a518a25528a248932fcf41b4f969.tar.xz
pre-commit-6cfa8e0963e9a518a25528a248932fcf41b4f969.zip
Adding upstream version 2.7.1.upstream/2.7.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing')
-rw-r--r--testing/util.py12
1 files changed, 11 insertions, 1 deletions
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)