You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

test_check_learnware.py 1.3 kB

12345678910111213141516171819202122232425262728293031323334353637
  1. import os
  2. import unittest
  3. import tempfile
  4. from learnware.client import LearnwareClient
  5. class TestCheckLearnware(unittest.TestCase):
  6. def setUp(self):
  7. unittest.TestCase.setUpClass()
  8. self.client = LearnwareClient()
  9. def test_check_learnware_pip(self):
  10. learnware_id = "00000154"
  11. with tempfile.TemporaryDirectory(prefix="learnware_") as tempdir:
  12. self.zip_path = os.path.join(tempdir, "test.zip")
  13. self.client.download_learnware(learnware_id, self.zip_path)
  14. LearnwareClient.check_learnware(self.zip_path)
  15. def test_check_learnware_conda(self):
  16. learnware_id = "00000148"
  17. with tempfile.TemporaryDirectory(prefix="learnware_") as tempdir:
  18. self.zip_path = os.path.join(tempdir, "test.zip")
  19. self.client.download_learnware(learnware_id, self.zip_path)
  20. LearnwareClient.check_learnware(self.zip_path)
  21. def test_check_learnware_dependency(self):
  22. learnware_id = "00000147"
  23. with tempfile.TemporaryDirectory(prefix="learnware_") as tempdir:
  24. self.zip_path = os.path.join(tempdir, "test.zip")
  25. self.client.download_learnware(learnware_id, self.zip_path)
  26. LearnwareClient.check_learnware(self.zip_path)
  27. if __name__ == "__main__":
  28. unittest.main()