[Zope-CVS] CVS: Packages/zpkgtools/zpkgtools/tests -
test_svnloader.py:1.2
Fred L. Drake, Jr.
fred at zope.com
Tue Apr 27 14:48:57 EDT 2004
Update of /cvs-repository/Packages/zpkgtools/zpkgtools/tests
In directory cvs.zope.org:/tmp/cvs-serv15234
Modified Files:
test_svnloader.py
Log Message:
move the "fake Subversion repository" support to a separate class to
facilitate re-use
=== Packages/zpkgtools/zpkgtools/tests/test_svnloader.py 1.1 => 1.2 ===
--- Packages/zpkgtools/zpkgtools/tests/test_svnloader.py:1.1 Mon Apr 26 17:45:07 2004
+++ Packages/zpkgtools/zpkgtools/tests/test_svnloader.py Tue Apr 27 14:48:54 2004
@@ -22,6 +22,28 @@
from zpkgtools import svnloader
+class SubversionRepositoryBase(unittest.TestCase):
+ """Mix-in test support class that provides a fake Subversion repository.
+
+ :ivar repodir: Directory containing the fake repository.
+
+ """
+
+ def setUp(self):
+ super(SubversionRepositoryBase, self).setUp()
+ self.svnrepodir = tempfile.mkdtemp()
+ os.mkdir(os.path.join(self.svnrepodir, "conf"))
+ os.mkdir(os.path.join(self.svnrepodir, "dav"))
+ os.mkdir(os.path.join(self.svnrepodir, "db"))
+ os.mkdir(os.path.join(self.svnrepodir, "hooks"))
+ os.mkdir(os.path.join(self.svnrepodir, "locks"))
+ open(os.path.join(self.svnrepodir, "db", "DB_CONFIG"), "w").close()
+
+ def tearDown(self):
+ super(SubversionRepositoryBase, self).tearDown()
+ shutil.rmtree(self.svnrepodir)
+
+
class SubversionUrlTestCase(unittest.TestCase):
"""Test handling of svn://host/... URLs."""
@@ -97,7 +119,8 @@
HOSTPART = "svn.example.com"
-class SubversionFileUrlTestCase(SubversionUrlTestCase):
+class SubversionFileUrlTestCase(SubversionRepositoryBase,
+ SubversionUrlTestCase):
"""Test handling of file:///... URLs."""
# We create a "stub" repository so is_subversion_url() can
@@ -109,18 +132,9 @@
HOSTPART = ""
def setUp(self):
- self.repodir = tempfile.mkdtemp()
- os.mkdir(os.path.join(self.repodir, "conf"))
- os.mkdir(os.path.join(self.repodir, "dav"))
- os.mkdir(os.path.join(self.repodir, "db"))
- os.mkdir(os.path.join(self.repodir, "hooks"))
- os.mkdir(os.path.join(self.repodir, "locks"))
- open(os.path.join(self.repodir, "db", "DB_CONFIG"), "w").close()
- parts = self.repodir.split(os.sep)
+ super(SubversionFileUrlTestCase, self).setUp()
+ parts = self.svnrepodir.split(os.sep)
self.SVNROOT = "/".join(parts)
-
- def tearDown(self):
- shutil.rmtree(self.repodir)
class SubversionLocalhostFileUrlTestCase(SubversionFileUrlTestCase):
More information about the Zope-CVS
mailing list