test_remove.py 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. @pytest.mark.destructive_test
  11. @pytest.mark.windows_whitelisted
  12. class SPMRemoveTest(SPMCase):
  13. """
  14. Validate the spm remove command
  15. """
  16. def setUp(self):
  17. self.config = self._spm_config()
  18. self._spm_build_files(self.config)
  19. @pytest.mark.slow_test(seconds=5) # Test takes >1 and <=5 seconds
  20. def test_spm_remove(self):
  21. """
  22. test spm remove from an inital repo install
  23. """
  24. # first install apache package
  25. self._spm_create_update_repo(self.config)
  26. install = self.run_spm("install", self.config, "apache")
  27. sls = os.path.join(self.config["formula_path"], "apache", "apache.sls")
  28. self.assertTrue(os.path.exists(sls))
  29. # now remove an make sure file is removed
  30. remove = self.run_spm("remove", self.config, "apache")
  31. sls = os.path.join(self.config["formula_path"], "apache", "apache.sls")
  32. self.assertFalse(os.path.exists(sls))
  33. self.assertIn("... removing apache", remove)
  34. def tearDown(self):
  35. shutil.rmtree(self._tmp_spm)