Update of /cvsroot/mailman/mailman3/src/mailman/tests
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24188
Modified Files:
Tag: 3.0
basetest.py
Log Message:
A base class for making tests easier to write.
--- NEW FILE: basetest.py ---
# 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.
"""Base classes for unit tests."""
import os
import unittest
import mailman
from mailman import startup
from mailman.config import configuration
from mailman.dbmgr import dbmgr
class ConfigTestBase(unittest.TestCase):
"""Base class for tests which require configuration and startup."""
def setUp(self):
# We know we're running the tests as ourselves so shut up the warnings.
configuration.quiet = True
# BAW: eventually, this should be generalized to be able to use any of
# the backend databases, probably by being tied into test.py.
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. Start
# everything up.
startup.startup()
def tearDown(self):
# Explicitly shut everything down, so we can isolate all unit tests.
# This will zap out the stub storages so that subsequent setUp() calls
# will create new instances, thus resetting the database. Note that
# we have to do something more drastic if we want to isolate tests
# running against persistent storages such as BerkeleyDB.
startup.shutdown()
_______________________________________________
Mailman-checkins mailing list
[EMAIL PROTECTED]
Unsubscribe: http://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org