def test_no_access(mock_os_access): conf = Config() conf.config_file = '/fake/file.conf' with pytest.raises(ConfigException): conf.load() assert mock_os_access.called is True assert mock_os_access.call_count is 1
def test_no_access(): conf = Config() conf.config_file = '/fake/file.conf' with mock.patch('os.access', return_value=False) as mock_os_access, \ pytest.raises(ConfigException): conf.load() assert mock_os_access.called is True assert mock_os_access.call_count is 1
def test_no_access(): conf = Config() conf.config_file = "/fake/file.conf" with mock.patch("os.access", return_value=False) as mock_os_access, pytest.raises( ConfigException): conf.load() assert mock_os_access.called is True assert mock_os_access.call_count is 1