[stable-2.9] Fix display of sanity test doc links.

The documentation links are now displayed when running from an install.

Previously the links were only displayed when running from source.
This was due to ansible-test checking for the presence of documentation files locally, which are only present when running from source.
The check is no longer necessary since there is a sanity test in place to enforce the presence of documentation for all sanity tests.
(cherry picked from commit 32d965e)

Co-authored-by: Matt Clay <matt@mystile.com>
This commit is contained in:
Matt Clay 2019-09-13 19:21:54 -07:00 committed by Toshio Kuratomi
parent 34a48dc2ca
commit 7f2ba1aaf8
2 changed files with 5 additions and 7 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- ansible-test now shows sanity test doc links when installed (previously the links were only visible when running from source)

View file

@ -364,6 +364,8 @@ class TestFailure(TestResult):
"""
:rtype: str
"""
if self.command != 'sanity':
return None # only sanity tests have docs links
# Use the major.minor version for the URL only if this a release that
# matches the pattern 2.4.0, otherwise, use 'devel'
@ -373,19 +375,13 @@ class TestFailure(TestResult):
url_version = '.'.join(ansible_version.split('.')[:2])
testing_docs_url = 'https://docs.ansible.com/ansible/%s/dev_guide/testing' % url_version
testing_docs_dir = 'docs/docsite/rst/dev_guide/testing'
url = '%s/%s/' % (testing_docs_url, self.command)
path = os.path.join(testing_docs_dir, self.command)
if self.test:
url += '%s.html' % self.test
path = os.path.join(path, '%s.rst' % self.test)
if os.path.exists(path):
return url
return None
return url
def format_title(self, help_link=None):
"""