Changeset 18 for branches/mk/tests
- Timestamp:
- 05/18/06 15:46:14 (7 years ago)
- Files:
-
- branches/mk/tests/test_init_cleanup.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/mk/tests/test_init_cleanup.py
r2 r18 2 2 from cheesecake.cheesecake_index import Cheesecake 3 3 import os 4 import shutil 5 import tempfile 6 4 7 datadir = os.path.abspath(os.path.join(os.path.dirname(__file__), "data")) 5 8 6 class TestInitCleanup: 9 class TestInitCleanup(object): 10 11 def tearDown(self): 12 if hasattr(self, 'cheesecake'): 13 if os.path.isdir(self.cheesecake.sandbox): 14 shutil.rmtree(self.cheesecake.sandbox) 15 if hasattr(self, 'logfile'): 16 if os.path.isfile(self.logfile): 17 os.unlink(self.logfile) 7 18 8 19 def test_init(self): 9 20 self.cheesecake = Cheesecake(path=os.path.join(datadir, "package1.tar.gz")) 10 self.logfile = os.path.join(self.cheesecake.sandbox, self.cheesecake.logfile) 21 assert os.path.isdir(self.cheesecake.sandbox_pkg_dir) 22 assert os.path.isfile(self.cheesecake.sandbox_pkg_file) 23 self.logfile = self.cheesecake.logfile 24 assert os.path.isfile(self.logfile) 25 26 def test_init_custom_logfile(self): 27 self.logfile = tempfile.mktemp() 28 self.cheesecake = Cheesecake(path=os.path.join(datadir, "package1.tar.gz"), 29 logfile=self.logfile) 11 30 assert os.path.isdir(self.cheesecake.sandbox_pkg_dir) 12 31 assert os.path.isfile(self.cheesecake.sandbox_pkg_file) … … 15 34 def test_cleanup(self): 16 35 self.cheesecake = Cheesecake(path=os.path.join(datadir, "package1.tar.gz")) 17 self.logfile = os.path.join(self.cheesecake.sandbox, self.cheesecake.logfile)18 36 self.cheesecake.cleanup() 19 37 assert not os.path.exists(self.cheesecake.sandbox_pkg_dir) 20 38 assert not os.path.exists(self.cheesecake.sandbox_pkg_file) 39 assert not os.path.exists(self.cheesecake.sandbox) 21 40 # Log file should not have been deleted 41 self.logfile = self.cheesecake.logfile 22 42 assert os.path.isfile(self.logfile) 23 43 … … 25 45 self.cheesecake = Cheesecake(path=os.path.join(datadir, "package1.tar.gz")) 26 46 self.cheesecake.index_install() 27 self.logfile = os.path.join(self.cheesecake.sandbox, self.cheesecake.logfile)28 47 self.cheesecake.cleanup() 29 48 assert not os.path.exists(self.cheesecake.sandbox_pkg_dir) 30 49 assert not os.path.exists(self.cheesecake.sandbox_pkg_file) 31 50 assert not os.path.exists(self.cheesecake.sandbox_install_dir) 51 assert not os.path.exists(self.cheesecake.sandbox) 32 52 # Log file should not have been deleted 53 self.logfile = self.cheesecake.logfile 33 54 assert os.path.isfile(self.logfile) 34
