def test_get_pylintrc_path(pylintrc_files, mocker): """Test that get_pylintrc_path finds the expected one in the hierarchy.""" search_paths, expected_path, __ = pylintrc_files mocker.patch("os.path.expanduser", return_value=search_paths[HOME_DIR]) actual_path = get_pylintrc_path( search_paths=list(search_paths.values()), home_path=search_paths[HOME_DIR], ) assert actual_path == expected_path
def get_pylintrc_path(self, filename): """Get the path to the most proximate pylintrc config to the file.""" parent = self.parentWidget() if parent is not None: project_dir = parent.main.projects.get_active_project_path() else: project_dir = None search_paths = [ osp.dirname(filename), # File's directory getcwd_or_home(), # Working directory project_dir, # Project directory osp.expanduser("~"), # Home directory ] return get_pylintrc_path(search_paths=search_paths)
def get_pylintrc_path(self, filename): """ Get the path to the most proximate pylintrc config to the file. """ search_paths = [ # File"s directory osp.dirname(filename), # Working directory getcwd_or_home(), # Project directory self.get_option("project_dir"), # Home directory osp.expanduser("~"), ] return get_pylintrc_path(search_paths=search_paths)