widgets: use qtutils.BlockSignals to manage blockSignals(bool)
[git-cola.git] / test / resources_test.py
blob26917afb5c47c1ee65cba4e00a13b28bc44991ac
1 from __future__ import absolute_import, division, unicode_literals
3 from mock import patch
4 import pytest
6 from cola import resources
7 from . import helper
10 @patch('cola.resources.compat')
11 @patch('cola.resources.get_prefix')
12 def test_command_unix(mock_prefix, mock_compat):
13 """Test the behavior of resources.command() on unix platforms"""
14 mock_compat.WIN32 = False
15 mock_prefix.return_value = helper.fixture()
17 expect = helper.fixture('bin', 'bare-cmd')
18 actual = resources.command('bare-cmd')
19 assert expect == actual
21 expect = helper.fixture('bin', 'exe-cmd')
22 actual = resources.command('exe-cmd')
23 assert expect == actual
26 @patch('cola.resources.compat')
27 @patch('cola.resources.get_prefix')
28 def test_command_win32(mock_prefix, mock_compat):
29 """Test the behavior of resources.command() on unix platforms"""
30 mock_compat.WIN32 = True
31 mock_prefix.return_value = helper.fixture()
33 expect = helper.fixture('bin', 'bare-cmd')
34 actual = resources.command('bare-cmd')
35 assert expect == actual
37 # Windows will return exe-cmd.exe because the path exists.
38 expect = helper.fixture('bin', 'exe-cmd.exe')
39 actual = resources.command('exe-cmd')
40 assert expect == actual
43 if __name__ == '__main__':
44 pytest.main([__file__])