Skip to content

Commit 7b5f82a

Browse files
committed
adding test to check that warning is printed when default Docker container is used on windows
1 parent bf3ffe6 commit 7b5f82a

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

tests/test_docker_warning.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
from __future__ import absolute_import
2+
import unittest
3+
from mock import mock
4+
from cwltool.utils import windows_default_container_id
5+
from cwltool.draft2tool import DEFAULT_CONTAINER_MSG, CommandLineTool
6+
7+
8+
class TestDefaultDockerWarning(unittest.TestCase):
9+
10+
# Test to check warning when default docker Container is used on Windows
11+
@mock.patch("cwltool.draft2tool.onWindows",return_value = True)
12+
@mock.patch("cwltool.draft2tool._logger")
13+
def test_default_docker_warning(self,mock_logger,mock_windows):
14+
15+
class TestCommandLineTool(CommandLineTool):
16+
def __init__(self, **kwargs):
17+
self.requirements=[]
18+
self.hints=[]
19+
20+
def find_default_container(args, builder):
21+
return windows_default_container_id
22+
23+
TestObject = TestCommandLineTool()
24+
TestObject.makeJobRunner()
25+
mock_logger.warning.assert_called_with(DEFAULT_CONTAINER_MSG%(windows_default_container_id, windows_default_container_id))

0 commit comments

Comments
 (0)