Skip to content

Commit

Permalink
Fix display of sanity test doc links.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mattclay authored and vasilyprokopov committed Sep 15, 2019
1 parent b44598f commit 5dbd4bc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/ansible-test-doc-links.yml
Original file line number Diff line number Diff line change
@@ -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)
10 changes: 3 additions & 7 deletions test/lib/ansible_test/_internal/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,8 @@ def find_docs(self):
"""
: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'
Expand All @@ -373,19 +375,13 @@ def find_docs(self):
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):
"""
Expand Down

0 comments on commit 5dbd4bc

Please sign in to comment.