github/workflows: use a virtualenv for setuptools
[git-cola.git] / test / resources_test.py
blobb1e1d6e07db5eaec0863b3c94659bb0c4cdca757
1 from __future__ import absolute_import, division, print_function, unicode_literals
3 from cola import resources
5 from . import helper
6 from .helper import patch
9 @patch('cola.resources.compat')
10 @patch('cola.resources.get_prefix')
11 def test_command_unix(mock_prefix, mock_compat):
12 """Test the behavior of resources.command() on unix platforms"""
13 mock_compat.WIN32 = False
14 mock_prefix.return_value = helper.fixture()
16 expect = helper.fixture('bin', 'bare-cmd')
17 actual = resources.command('bare-cmd')
18 assert expect == actual
20 expect = helper.fixture('bin', 'exe-cmd')
21 actual = resources.command('exe-cmd')
22 assert expect == actual
25 @patch('cola.resources.compat')
26 @patch('cola.resources.get_prefix')
27 def test_command_win32(mock_prefix, mock_compat):
28 """Test the behavior of resources.command() on unix platforms"""
29 mock_compat.WIN32 = True
30 mock_prefix.return_value = helper.fixture()
32 expect = helper.fixture('bin', 'bare-cmd')
33 actual = resources.command('bare-cmd')
34 assert expect == actual
36 # Windows will return exe-cmd.exe because the path exists.
37 expect = helper.fixture('bin', 'exe-cmd.exe')
38 actual = resources.command('exe-cmd')
39 assert expect == actual