1 from cola
import resources
4 from .helper
import patch
7 @patch('cola.resources.compat')
8 @patch('cola.resources.get_prefix')
9 def test_command_unix(mock_prefix
, mock_compat
):
10 """Test the behavior of resources.command() on unix platforms"""
11 mock_compat
.WIN32
= False
12 mock_prefix
.return_value
= helper
.fixture()
14 expect
= helper
.fixture('bin', 'bare-cmd')
15 actual
= resources
.command('bare-cmd')
16 assert expect
== actual
18 expect
= helper
.fixture('bin', 'exe-cmd')
19 actual
= resources
.command('exe-cmd')
20 assert expect
== actual
23 @patch('cola.resources.compat')
24 @patch('cola.resources.get_prefix')
25 def test_command_win32(mock_prefix
, mock_compat
):
26 """Test the behavior of resources.command() on unix platforms"""
27 mock_compat
.WIN32
= True
28 mock_prefix
.return_value
= helper
.fixture()
30 expect
= helper
.fixture('bin', 'bare-cmd')
31 actual
= resources
.command('bare-cmd')
32 assert expect
== actual
34 # Windows will return exe-cmd.exe because the path exists.
35 expect
= helper
.fixture('bin', 'exe-cmd.exe')
36 actual
= resources
.command('exe-cmd')
37 assert expect
== actual