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.1 kB

12345678910111213141516171819202122232425262728293031323334
  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. email = "liujd@lamda.nju.edu.cn"
  9. token = "f7e647146a314c6e8b4e2e1079c4bca4"
  10. self.client = LearnwareClient()
  11. self.client.login(email, token)
  12. def test_check_learnware_pip(self):
  13. learnware_id = "00000154"
  14. with tempfile.TemporaryDirectory(prefix="learnware_") as tempdir:
  15. self.zip_path = os.path.join(tempdir, "test.zip")
  16. self.client.download_learnware(learnware_id, self.zip_path)
  17. LearnwareClient.check_learnware(self.zip_path)
  18. def test_check_learnware_conda(self):
  19. learnware_id = "00000148"
  20. with tempfile.TemporaryDirectory(prefix="learnware_") as tempdir:
  21. self.zip_path = os.path.join(tempdir, "test.zip")
  22. self.client.download_learnware(learnware_id, self.zip_path)
  23. LearnwareClient.check_learnware(self.zip_path)
  24. if __name__ == "__main__":
  25. unittest.main()