Fix test which fails on some python 2.6 installs.

This commit is contained in:
Matt Clay 2017-02-08 13:58:24 -08:00
parent 65815c3875
commit 57a5490c41

View file

@ -21,6 +21,7 @@ from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import pytest
try:
import builtins
@ -100,7 +101,8 @@ class TestSetModeIfDifferent(TestSetModeIfDifferentBase):
with patch('os.lchmod', return_value=None, create=True) as m_os:
m.side_effect = [self.mock_stat1, self.mock_stat2, self.mock_stat2]
self.am._symbolic_mode_to_octal = MagicMock(side_effect=Exception)
self.assertRaises(SystemExit, self.am.set_mode_if_different, '/path/to/file', 'o+w,g+w,a-r', False)
with pytest.raises(SystemExit):
self.am.set_mode_if_different('/path/to/file', 'o+w,g+w,a-r', False)
original_hasattr = hasattr
def _hasattr(obj, name):