root/branches/mk/tests/test_index_installability.py

Revision 8, 2.1 kB (checked in by grig, 7 years ago)

Refactored CodeParser? functionality. Use model.py from Michael Hudson's docextractor package.

Added configuration file. The first time cheesecake_index is run, it will create a directory
called ~/.cheesecake and a file called ~/.cheesecake/my_config.py containing default values
for various variables used throughout the index computation.

Added more unit tests.

Line 
1 import _path_cheesecake
2 from cheesecake.cheesecake_index import Cheesecake
3 import os
4 datadir = os.path.abspath(os.path.join(os.path.dirname(__file__), "data"))
5
6 class TestIndexInstallability:
7
8     def setUp(self):
9         self.cheesecake = None
10
11     def tearDown(self):
12         if not self.cheesecake:
13             return
14         self.cheesecake.cleanup()
15         os.unlink(self.cheesecake.logfile)
16
17     def test_index_installability_local_path(self):
18         self.cheesecake = Cheesecake(path=os.path.join(datadir, "nose-0.8.3.tar.gz"))
19         assert self.cheesecake.max_cheesecake_index_installability == \
20             self.cheesecake.INDEX_PYPI_DOWNLOAD + self.cheesecake.INDEX_UNPACK + \
21             self.cheesecake.INDEX_UNPACK_DIR + self.cheesecake.INDEX_INSTALL
22                                    
23         index_types = ["pypi_download", "unpack", "unpack_dir", "install"]
24         cheesecake_index_installability = self.cheesecake.process_partial_index("INSTALLABILITY",\
25                                          index_types, self.cheesecake.max_cheesecake_index_installability)
26         assert cheesecake_index_installability == self.cheesecake.INDEX_UNPACK + \
27                 self.cheesecake.INDEX_UNPACK_DIR + self.cheesecake.INDEX_INSTALL
28
29     def test_index_installability_url_download(self):
30         self.cheesecake = Cheesecake(url="http://www.agilistas.org/cheesecake/nose-0.8.3.tar.gz")
31         assert self.cheesecake.max_cheesecake_index_installability == \
32             self.cheesecake.INDEX_PYPI_DOWNLOAD + self.cheesecake.INDEX_UNPACK + \
33             self.cheesecake.INDEX_UNPACK_DIR + self.cheesecake.INDEX_INSTALL
34         index_types = ["pypi_download", "url_download", "unpack", "unpack_dir", "install"]
35         cheesecake_index_installability = self.cheesecake.process_partial_index("INSTALLABILITY",\
36                                          index_types, self.cheesecake.max_cheesecake_index_installability)
37         assert cheesecake_index_installability == \
38             self.cheesecake.INDEX_URL_DOWNLOAD + self.cheesecake.INDEX_UNPACK + \
39             self.cheesecake.INDEX_UNPACK_DIR + self.cheesecake.INDEX_INSTALL
Note: See TracBrowser for help on using the browser.