1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_elpa_ebuild.py
~~~~~~~~~~~~~~~~~~~
ELPA ebuild generator test suite
:copyright: (c) 2013 by Jauhien Piatlicki
:license: GPL-2, see LICENSE for more details.
"""
import os, unittest
from g_sorcery import package_db
from g_elpa import elpa_db, ebuild
from tests.base import BaseTest
from tests.test_elpa_db import fill_database, packages
class TestElpaEbuildGenerator(BaseTest):
def test_generate(self):
edb = elpa_db.ElpaDB(os.path.join(self.tempdir.name, 'db'),
repo_uri = 'http://127.0.0.1:8080')
fill_database(edb, packages, self.tempdir.name)
ebuild_generator = ebuild.ElpaEbuildWithoutDigestGenerator(edb)
src = ebuild_generator.generate(package_db.Package('app-emacs', 'ack', '1.2'))
self.assertEqual(src,
['# automatically generated by g-elpa',
'# please do not edit this file', '',
'EAPI=5', '', 'inherit g-elpa', '',
'DESCRIPTION="Interface to ack-like source code search tools"',
'HOMEPAGE="http://127.0.0.1:8080"', 'SRC_URI=""',
'LICENSE="GPL-2"', '', 'SLOT="0"', 'KEYWORDS="~amd64 ~x86"',
'IUSE=""', '', 'REPO_URI="http://127.0.0.1:8080"',
'PKG_TYPE="tar"', 'REALNAME="ack"', '', 'DEPEND=""', 'RDEPEND=""'])
src = ebuild_generator.generate(package_db.Package('app-emacs', 'dict-tree', '0.12.8'))
self.assertEqual(src,
['# automatically generated by g-elpa',
'# please do not edit this file', '', 'EAPI=5', '',
'inherit g-elpa', '', 'DESCRIPTION="Dictionary data structure"',
'HOMEPAGE="http://127.0.0.1:8080"', 'SRC_URI=""',
'LICENSE="GPL-2"', '', 'SLOT="0"',
'KEYWORDS="~amd64 ~x86"', 'IUSE=""', '',
'REPO_URI="http://127.0.0.1:8080"', 'PKG_TYPE="tar"',
'REALNAME="dict-tree"', '',
'DEPEND="app-emacs/trie-0.2.5\napp-emacs/tNFA-0.1.1\napp-emacs/heap-0.3"',
'RDEPEND="app-emacs/trie-0.2.5\napp-emacs/tNFA-0.1.1\napp-emacs/heap-0.3"'])
def suite():
suite = unittest.TestSuite()
suite.addTest(TestElpaEbuildGenerator('test_generate'))
return suite
|