Update of /cvsroot/mailman/mailman3/src/mailman/stubbackend/tests
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13208
Modified Files:
test_config2.py
Log Message:
A little bit of cleaning up.
Index: test_config2.py
===================================================================
RCS file: /cvsroot/mailman/mailman3/src/mailman/stubbackend/tests/test_config2.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- test_config2.py 22 Apr 2004 04:31:33 -0000 1.1
+++ test_config2.py 24 Apr 2004 00:08:32 -0000 1.2
@@ -1,38 +1,60 @@
+# Copyright (C) 2004 Barry A. Warsaw
+#
+# 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., 59 Temple
+# Place - Suite 330, Boston, MA 02111-1307, USA.
+
+"""Test the basic configuration stuff."""
import os
+import sys
import unittest
from protocols.api import adapt
+from mailman import dbmgr
from mailman.config import configuration
-from mailman.dbmgr import dbmgr
-
from mailman.interfaces.storages import IListStorage
-class TestConfig2(unittest.TestCase):
+
+class TestConfig2(unittest.TestCase):
def test_config(self):
- if dbmgr.lists:
+ if dbmgr.dbmgr.lists:
# test.py keeps dbmgr form last time; try to clear it
- import sys
- import mailman.dbmgr
- sys.modules['mailman.dbmgr'].dbmgr = \
- mailman.dbmgr.DatabaseManager()
-
- here = os.path.abspath(os.path.dirname(__file__))
- mmroot = os.path.normpath(os.path.join(here, '../../../..'))
- conffile = os.path.normpath(os.path.join(mmroot,
- 'etc/backendtest.conf'))
+ sys.modules['mailman.dbmgr'].dbmgr = dbmgr.DatabaseManager()
+ # Re-calculate the path to the etc directory. BAW: assume, for now,
+ # that it's a sibling of the directory of the parent of the top-level
+ # mailman package.
+ import mailman
+ mmhere = os.path.abspath(os.path.dirname(mailman.__file__))
+ mmroot = os.path.normpath(os.path.join(mmhere, os.pardir, os.pardir))
+ conffile = os.path.normpath(
+ os.path.join(mmroot, 'etc/backendtest.conf'))
configuration.configure(conffile)
- # after the above line, dbmgr should know about our backend
- lists = adapt(dbmgr.lists, IListStorage)
- # if adapt doesn't complain, we have a thing that works as IListStorage
- self.assert_(lists)
+ # After the above line, dbmgr should know about our backend.
+ lists = adapt(dbmgr.dbmgr.lists, IListStorage)
+ # If adapt doesn't complain, we have a thing that works as IListStorage
+ self.failUnless(lists)
+
+
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestConfig2))
return suite
-
+
+
+
if __name__ == '__main__':
unittest.main()
_______________________________________________
Mailman-checkins mailing list
[EMAIL PROTECTED]
Unsubscribe: http://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org