test_remove.py 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. # -*- coding: utf-8 -*-
  2. """
  3. Tests for the spm remove utility
  4. """
  5. from __future__ import absolute_import, print_function, unicode_literals
  6. import os
  7. import shutil
  8. import pytest
  9. from tests.support.case import SPMCase
  10. from tests.support.helpers import destructiveTest, slowTest
  11. @destructiveTest
  12. @pytest.mark.windows_whitelisted
  13. class SPMRemoveTest(SPMCase):
  14. """
  15. Validate the spm remove command
  16. """
  17. def setUp(self):
  18. self.config = self._spm_config()
  19. self._spm_build_files(self.config)
  20. @slowTest
  21. def test_spm_remove(self):
  22. """
  23. test spm remove from an inital repo install
  24. """
  25. # first install apache package
  26. self._spm_create_update_repo(self.config)
  27. install = self.run_spm("install", self.config, "apache")
  28. sls = os.path.join(self.config["formula_path"], "apache", "apache.sls")
  29. self.assertTrue(os.path.exists(sls))
  30. # now remove an make sure file is removed
  31. remove = self.run_spm("remove", self.config, "apache")
  32. sls = os.path.join(self.config["formula_path"], "apache", "apache.sls")
  33. self.assertFalse(os.path.exists(sls))
  34. self.assertIn("... removing apache", remove)
  35. def tearDown(self):
  36. shutil.rmtree(self._tmp_spm)