forget the past.
forget the past.
import unittest
import tempfile
import os
from os.path import join
from logilab.common import testlib
from logilab.devtools.lib.pkginfo import pkginfo_save
from oobrother.plugins.devtools import pkginfo_create
__revision__ = '$Id: unittest_devtools.py,v 1.7 2006-03-26 17:58:48 nico Exp $'
PKGINFO_SCHEMA = (
('modname', 'string', 'name', (), True, 'duh'),
('version', 'string', 'version', (), True, '0.1'),
('copyright', 'text', 'copyright', (), True,
'Copyright (c) %s LOGILAB S.A. (Paris, FRANCE).'),
('license', 'choice', 'license', ('GPL', 'unk'),
False, 'GPL'),
)
class PkgInfoEditFuncTC(testlib.TestCase):
pkginfo = join(tempfile.gettempdir(), '__pkginfo__.py')
def tearDown(self):
try:
os.remove(self.pkginfo)
except:
pass
def test_create(self):
pkginfo_create(PKGINFO_SCHEMA, self.pkginfo,
{'modname': 'TestDevtools',
'license': 'GPL',
'copyright': 'copyright Logilab 2003'})
LICENSE = ('''
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
# St, Fifth Floor, Boston, MA 02110-1301, USA.
# On Debian systems, the complete text of the GNU General Public License may be
# found in '/usr/share/common-licenses/GPL'.
"""package information for TestDevtools"""
__revision__ = '$I'''+'''d:$'
modname = 'TestDevtools'
copyright = 'copyright Logilab 2003'
license = 'GPL'
numversion = [int(v) for v in version.split('.')]
''').strip()
self.assertTextEquals(LICENSE, open(self.pkginfo).read().strip())
def test_save(self):
pkginfo_create(PKGINFO_SCHEMA, self.pkginfo,
{'modname': 'TestDevtools',
'license': 'GPL',
'copyright': 'copyright Logilab 2003'})
pkginfo_save(self.pkginfo, {'modname': 'TestDevtoolsYO',
'license': 'LCL'})
LICENSE = ('''
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
# St, Fifth Floor, Boston, MA 02110-1301, USA.
# On Debian systems, the complete text of the GNU General Public License may be
# found in '/usr/share/common-licenses/GPL'.
"""package information for TestDevtools"""
__revision__ = '$I'''+'''d:$'
modname = 'TestDevtoolsYO'
copyright = 'copyright Logilab 2003'
license = 'LCL'
numversion = [int(v) for v in version.split('.')]
''').strip()
self.assertTextEquals(LICENSE, open(self.pkginfo).read().strip())
if __name__ == '__main__':
unittest.main()