root/branches/mk/tests/unit/test_index_installability.py

Revision 80, 1.7 kB (checked in by mk, 6 years ago)

Indices can now hold dependencies (via decide() interface).
Certain steps (like installation of a package) during scoring are run only

on demand - to satisfy indices dependencies.

Implemented "static" profile by setting appropriate dependencies on

IndexInstall? (closes ticket #37).

Line 
1 import os
2
3 import _path_cheesecake
4 from _helper_cheesecake import DATA_PATH
5
6 from cheesecake.cheesecake_index import Cheesecake
7 from cheesecake.cheesecake_index import IndexPyPIDownload
8 from cheesecake.cheesecake_index import IndexUnpack
9 from cheesecake.cheesecake_index import IndexUnpackDir
10 from cheesecake.cheesecake_index import IndexSetupPy
11 from cheesecake.cheesecake_index import IndexInstall
12 from cheesecake.cheesecake_index import IndexUrlDownload
13 from cheesecake.cheesecake_index import IndexGeneratedFiles
14
15
16 class TestIndexInstallability(object):
17     def setUp(self):
18         self.cheesecake = None
19
20     def tearDown(self):
21         if not self.cheesecake:
22             return
23         self.cheesecake.cleanup()
24
25     def test_index_installability_local_path(self):
26         self.cheesecake = Cheesecake(path=os.path.join(DATA_PATH, "nose-0.8.3.tar.gz"))
27
28         index = self.cheesecake.index["INSTALLABILITY"]
29         parts = [IndexUnpack, IndexUnpackDir, IndexSetupPy, IndexInstall, IndexGeneratedFiles]
30
31         assert index.max_value == sum(map(lambda x: x.max_value, parts))
32
33         index.compute_with(self.cheesecake)
34         assert index.value == sum(map(lambda x: x.max_value, parts))
35
36     def test_index_installability_url_download(self):
37         self.cheesecake = Cheesecake(url="http://www.agilistas.org/cheesecake/nose-0.8.3.tar.gz")
38
39         index = self.cheesecake.index["INSTALLABILITY"]
40         parts = [IndexUrlDownload, IndexUnpack, IndexUnpackDir, IndexSetupPy, IndexInstall, IndexGeneratedFiles]
41
42         assert index.max_value == sum(map(lambda x: x.max_value, parts))
43
44         index.compute_with(self.cheesecake)
45         assert index.value == sum(map(lambda x: x.max_value, parts))
Note: See TracBrowser for help on using the browser.