From 57a5490c418064203bd20cb7bfe789d39089eb12 Mon Sep 17 00:00:00 2001 From: Matt Clay Date: Wed, 8 Feb 2017 13:58:24 -0800 Subject: [PATCH] Fix test which fails on some python 2.6 installs. --- test/units/module_utils/basic/test_set_mode_if_different.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/units/module_utils/basic/test_set_mode_if_different.py b/test/units/module_utils/basic/test_set_mode_if_different.py index e13f2ec668..df5d63b449 100644 --- a/test/units/module_utils/basic/test_set_mode_if_different.py +++ b/test/units/module_utils/basic/test_set_mode_if_different.py @@ -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):