test_r_pack.py 1020 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. """
  2. Created on Sun Jun 08 10:15:22 2018
  3. @author: Sanjeet Bhatti
  4. """
  5. from grass.gunittest.case import TestCase
  6. from grass.gunittest.main import test
  7. from grass.gunittest.gmodules import SimpleModule
  8. import os
  9. class TestRPack(TestCase):
  10. """Test r.pack script"""
  11. mapName = 'aspect'
  12. outFile = 'aspect.pack'
  13. @classmethod
  14. def setUpClass(cls):
  15. """Create maps in a small region."""
  16. cls.use_temp_region()
  17. cls.runModule('g.region', raster=cls.mapName, flags='p')
  18. @classmethod
  19. def tearDownClass(cls):
  20. """Remove temporary region. Delete output file"""
  21. cls.del_temp_region()
  22. if (os.path.isfile(cls.outFile)):
  23. os.remove(cls.outFile)
  24. def test_r_pack(self):
  25. """Create a pack file test"""
  26. module = SimpleModule('r.pack', input=self.mapName,
  27. output=self.outFile)
  28. self.assertModule(module)
  29. self.assertFileExists(filename=self.outFile)
  30. if __name__ == '__main__':
  31. test()