def test_newer_than_2_3_should_not_be_altered(self, mock_setdefaulttimeout): set_default_socket_timeout_if_python_2_3() # we should only ever set default timeout on python 2.3 or earlier # Elsewhere we should leave it alone, and be set to the default of None # See https://bugzilla.redhat.com/show_bug.cgi?id=1195446 if sys.version_info[0] != 2: self.fail("This test only passes on python 2, not python3.") if sys.version_info[1] < 3: self.fail("Don't expect this or any other tests to work on python 2.2 or earlier.") self.assertFalse(mock_setdefaulttimeout.called)
def test_2_3_should_be_altered_once(self, mock_setdefaulttimeout): set_default_socket_timeout_if_python_2_3() set_default_socket_timeout_if_python_2_3() mock_setdefaulttimeout.assert_called_once_with(60)