# 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
+
+import sys
import os
import shutil
import time
import config
from beuuid import uuid_gen
-from rcs import RCS, RCStestCase, CommandError
+import rcs
+from rcs import RCS
client = config.get_val("arch_client")
if client is None:
def __init__(self, file):
self.file = file
Exception.__init__(self, "Can't automatically add file %s" % file)
-
-class ArchTestCase(RCStestCase):
- Class = Arch
-unitsuite = unittest.TestLoader().loadTestsFromTestCase(ArchTestCase)
+
+\f
+rcs.make_rcs_testcase_subclasses(Arch, sys.modules[__name__])
+
+unitsuite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
suite = unittest.TestSuite([unitsuite, doctest.DocTestSuite()])
# 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
+
+import sys
import os
import re
import unittest
import doctest
-from rcs import RCS, RCStestCase, CommandError
+import rcs
+from rcs import RCS
def new():
return Bzr()
def postcommit(self):
try:
self._u_invoke_client('merge')
- except CommandError, e:
+ except rcs.CommandError, e:
if ('No merge branch known or specified' in e.err_str or
'No merge location known or specified' in e.err_str):
pass
if len(self._u_invoke_client('status', directory=directory)[1]) > 0:
self.commit('Merge from upstream')
-class BzrTestCase(RCStestCase):
- Class = Bzr
+\f
+rcs.make_rcs_testcase_subclasses(Bzr, sys.modules[__name__])
-unitsuite = unittest.TestLoader().loadTestsFromTestCase(BzrTestCase)
+unitsuite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
suite = unittest.TestSuite([unitsuite, doctest.DocTestSuite()])
# 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
+
+import sys
import os
import re
import unittest
import doctest
-from rcs import RCS, RCStestCase, CommandError
+import rcs
+from rcs import RCS
def new():
return Git()
assert len(match.groups()) == 3
revision = match.groups()[1]
return revision
-
-class GitTestCase(RCStestCase):
- Class = Git
-unitsuite = unittest.TestLoader().loadTestsFromTestCase(GitTestCase)
+\f
+rcs.make_rcs_testcase_subclasses(Git, sys.modules[__name__])
+
+unitsuite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
suite = unittest.TestSuite([unitsuite, doctest.DocTestSuite()])
# 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
+
+import sys
import os
import re
import unittest
import doctest
-from rcs import RCS, RCStestCase, CommandError, SettingIDnotSupported
+import rcs
+from rcs import RCS
def new():
return Hg()
standard Mercurial.
http://www.selenic.com/mercurial/wiki/index.cgi/ConfigExtension
"""
- raise SettingIDnotSupported
+ raise rcs.SettingIDnotSupported
def _rcs_add(self, path):
self._u_invoke_client("add", path)
def _rcs_remove(self, path):
revision = match.groups()[0]
return revision
-class HgTestCase(RCStestCase):
- Class = Hg
+\f
+rcs.make_rcs_testcase_subclasses(Hg, sys.modules[__name__])
-unitsuite = unittest.TestLoader().loadTestsFromTestCase(HgTestCase)
+unitsuite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
suite = unittest.TestSuite([unitsuite, doctest.DocTestSuite()])
f.close
return (summary, body)
-
-class RCStestCase(unittest.TestCase):
+\f
+class RCSTestCase(unittest.TestCase):
Class = RCS
def __init__(self, *args, **kwargs):
unittest.TestCase.__init__(self, *args, **kwargs)
self.versionTest('a/b/text')
self.rcs.recursive_remove(self.fullPath('a'))
-unitsuite = unittest.TestLoader().loadTestsFromTestCase(RCStestCase)
+
+def make_rcs_testcase_subclasses(rcs_class, namespace):
+ """ Make RCSTestCase subclasses for rcs_class in the namespace. """
+ rcs_testcase_classes = [
+ c for c in (
+ ob for ob in globals().values() if isinstance(ob, type))
+ if issubclass(c, RCSTestCase)]
+
+ for base_class in rcs_testcase_classes:
+ testcase_class_name = rcs_class.__name__ + base_class.__name__
+ testcase_class_bases = (base_class,)
+ testcase_class_dict = dict(base_class.__dict__)
+ testcase_class_dict['Class'] = rcs_class
+ testcase_class = type(
+ testcase_class_name, testcase_class_bases, testcase_class_dict)
+ setattr(namespace, testcase_class_name, testcase_class)
+
+
+unitsuite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
suite = unittest.TestSuite([unitsuite, doctest.DocTestSuite()])