test_gitforge.py 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import os
  2. import shutil
  3. import infra
  4. class GitforgeTestBase(infra.basetest.BRConfigTest):
  5. config = \
  6. """
  7. BR2_BACKUP_SITE=""
  8. """
  9. def setUp(self):
  10. super(GitforgeTestBase, self).setUp()
  11. def tearDown(self):
  12. self.show_msg("Cleaning up")
  13. if self.b and not self.keepbuilds:
  14. self.b.delete()
  15. def check_download(self, package):
  16. # store downloaded tarball inside the output dir so the test infra
  17. # cleans it up at the end
  18. dl_dir = os.path.join(self.builddir, "dl")
  19. # enforce we test the download
  20. if os.path.exists(dl_dir):
  21. shutil.rmtree(dl_dir)
  22. env = {"BR2_DL_DIR": dl_dir}
  23. self.b.build(["{}-dirclean".format(package),
  24. "{}-legal-info".format(package)],
  25. env)
  26. class TestGitHub(GitforgeTestBase):
  27. br2_external = [infra.filepath("tests/download/br2-external/github")]
  28. def test_run(self):
  29. self.check_download("github-helper-tag")
  30. self.check_download("github-helper-hash")
  31. self.check_download("github-release")