Skip to content

Commit

Permalink
Modify docker availability check
Browse files Browse the repository at this point in the history
  • Loading branch information
BSchilperoort committed Jan 25, 2024
1 parent 4a8a761 commit b67ca69
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions tests/test_docker_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@
)


try:
docker.APIClient()
docker_available = True
except docker.errors.DockerException as err:
if "Error while fetching server API version" in err.value:
docker_available = False
else:
raise err # Unknown error.
def docker_available():
try:
docker.APIClient()
return True
except docker.errors.DockerException as err:
if "Error while fetching server API version" in err.value:
return False
else:
raise err # Unknown error.


cfg_file = data_folder / "config_file_docker.txt"
Expand Down Expand Up @@ -87,7 +88,7 @@ def prepare_data_config(tmpdir_factory, prep_input_data) -> Path:
return config_dir


@pytest.mark.skipif(not docker_available, reason="Docker not available")
@pytest.mark.skipif(not docker_available(), reason="Docker not available")
def test_initialize(prepare_data_config):
model = StemmusScopeBmi()
model.initialize(str(prepare_data_config))
Expand Down

0 comments on commit b67ca69

Please sign in to comment.