[Zope-CVS] CVS: Packages/zpkgtools/zpkgtools/tests -
test_config.py:1.1 zpkg-error-1.conf:1.1
zpkg-error-2.conf:1.1 zpkg-ok.conf:1.1
Fred L. Drake, Jr.
fred at zope.com
Wed Mar 10 16:27:36 EST 2004
Update of /cvs-repository/Packages/zpkgtools/zpkgtools/tests
In directory cvs.zope.org:/tmp/cvs-serv22284/zpkgtools/tests
Added Files:
test_config.py zpkg-error-1.conf zpkg-error-2.conf
zpkg-ok.conf
Log Message:
add a dead-simple configuration file, allowing the user to set up an
initial location map
=== Added File Packages/zpkgtools/zpkgtools/tests/test_config.py ===
##############################################################################
#
# Copyright (c) 2004 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Tests for zpkgtools.config."""
import os
import unittest
from zpkgtools import config
here = os.path.dirname(os.path.abspath(__file__))
class ConfigTestCase(unittest.TestCase):
def test_defaultConfigurationPath(self):
# Not really sure what makes sense to check here, but at least
# make sure it returns a string:
path = config.defaultConfigurationPath()
self.assert_(isinstance(path, basestring))
def test_constructor(self):
path = os.path.join(here, "zpkg-ok.conf")
cf = config.Configuration(path)
self.assertEqual(
cf.location_maps,
["cvs://cvs.example.org/cvsroot:module/package/PACAGES.txt",
os.path.join(here, "relative/path.txt")])
def test_constructor_bad_config_setting(self):
# unknown option:
path = os.path.join(here, "zpkg-error-1.conf")
self.assertRaises(ValueError, config.Configuration, path)
# repository-map without path
path = os.path.join(here, "zpkg-error-2.conf")
self.assertRaises(ValueError, config.Configuration, path)
def test_constructor_no_such_file(self):
path = os.path.join(here, "no-such-file")
self.assertRaises(IOError, config.Configuration, path)
def test_suite():
return unittest.makeSuite(ConfigTestCase)
if __name__ == "__main__":
unittest.main(defaultTest="test_suite")
=== Added File Packages/zpkgtools/zpkgtools/tests/zpkg-error-1.conf ===
# This test configuration file uses an unknown option.
unknown-option 42
=== Added File Packages/zpkgtools/zpkgtools/tests/zpkg-error-2.conf ===
# This configuration file uses repository-map without a path.
repository-map
=== Added File Packages/zpkgtools/zpkgtools/tests/zpkg-ok.conf ===
# This is a sample configuration file for zpkg.
# It is only used for the tests.
repository-map cvs://cvs.example.org/cvsroot:module/package/PACAGES.txt
repository-map relative/path.txt
More information about the Zope-CVS
mailing list