tests: remove #! lines and leverage pytest further
[git-cola.git] / test / resources_test.py
blobd7fa64192fa4c5e792abbf2bfa475596d9960135
1 from __future__ import absolute_import, division, unicode_literals
3 from mock import patch
5 from cola import resources
6 from . import helper
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