remove docker_is_running check from source

Moved to testing.util so it can be used for the skipif_cant_run_docker
test hooks.
This commit is contained in:
Ruairidh MacLeod
2020-08-23 00:14:10 +00:00
committed by Anthony Sottile
parent f1de792877
commit eb8b48aeb4
4 changed files with 11 additions and 31 deletions

View File

@@ -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)