rosdistro_check_urls_test.py 1.2 KB

1234567891011121314151617181920212223242526272829
  1. #!/usr/bin/env python
  2. import os
  3. from rosdistro import get_index
  4. from scripts import eol_distro_names
  5. from scripts.check_rosdistro_urls import main as check_rosdistro_urls
  6. from .fold_block import Fold
  7. FILES_DIR = os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..'))
  8. def test_rosdistro_urls():
  9. index_url = 'file://' + FILES_DIR + '/index.yaml'
  10. index = get_index(index_url)
  11. failed_distros = []
  12. fold_blocks = []
  13. for distro_name in sorted(index.distributions.keys()):
  14. if distro_name in eol_distro_names:
  15. continue
  16. with Fold() as fold:
  17. print("""Checking if the distribution files of '%s' contain valid urls for known hosting services.
  18. If this fails you can run 'scripts/check_rosdistro_urls.py file://`pwd`/%s %s' to perform the same check locally.
  19. """ % (distro_name, 'index.yaml', distro_name))
  20. if not check_rosdistro_urls(index_url, distro_name):
  21. failed_distros.append(distro_name)
  22. fold_blocks.append(fold.get_block_name())
  23. assert not failed_distros, "There were problems with urls in the distribution files for these distros: %s, see folded blocks above for details: %s" % (failed_distros, fold_blocks)