From bc2f4365b5c0dd9432f3ed64f13125ec9fb1566b Mon Sep 17 00:00:00 2001 From: John R Barker Date: Tue, 12 Sep 2017 13:30:49 +0100 Subject: [PATCH] Correctly validate module name for modules with aliases (#29957) * Correctly validate module name for modules with aliases If a module has an alias (ie is a symlink) then we need to ensure that DOCUMENTATION.module is set to the main name, not the aliased name * formatting --- test/sanity/validate-modules/main.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/test/sanity/validate-modules/main.py b/test/sanity/validate-modules/main.py index b0d1e1a7588..b39038b27e0 100755 --- a/test/sanity/validate-modules/main.py +++ b/test/sanity/validate-modules/main.py @@ -802,7 +802,14 @@ class ModuleValidator(Validator): msg='Module deprecated, but DOCUMENTATION.deprecated is missing' ) - self._validate_docs_schema(doc, doc_schema(self.object_name.split('.')[0]), 'DOCUMENTATION', 305) + if os.path.islink(self.object_path): + # This module has an alias, which we can tell as it's a symlink + # Rather than checking for `module: $filename` we need to check against the true filename + self._validate_docs_schema(doc, doc_schema(os.readlink(self.object_path).split('.')[0]), 'DOCUMENTATION', 305) + else: + # This is the normal case + self._validate_docs_schema(doc, doc_schema(self.object_name.split('.')[0]), 'DOCUMENTATION', 305) + self._check_version_added(doc) self._check_for_new_args(doc)