[Zope-CVS] CVS: Packages/zpkgtools/zpkgtools/tests -
test_include.py:1.3
Fred L. Drake, Jr.
fred at zope.com
Tue Mar 30 22:07:24 EST 2004
Update of /cvs-repository/Packages/zpkgtools/zpkgtools/tests
In directory cvs.zope.org:/tmp/cvs-serv22831/zpkgtools/tests
Modified Files:
test_include.py
Log Message:
move the include specification to a separate object, cleaning out a lot of
cruft along the way
=== Packages/zpkgtools/zpkgtools/tests/test_include.py 1.2 => 1.3 ===
--- Packages/zpkgtools/zpkgtools/tests/test_include.py:1.2 Tue Mar 30 16:37:07 2004
+++ Packages/zpkgtools/zpkgtools/tests/test_include.py Tue Mar 30 22:07:23 2004
@@ -49,22 +49,24 @@
# Another comment.
""")
- self.processor.loadSpecification(f, "<string>")
- self.assertEqual(len(self.processor.excludes), 1)
- self.assertEqual(len(self.processor.includes), 2)
+ spec = include.Specification(self.source)
+ spec.load(f, "<string>")
+ self.assertEqual(len(spec.excludes), 1)
+ self.assertEqual(len(spec.includes), 2)
self.assert_(join(self.source, "ignorethis.txt")
- in self.processor.excludes)
- self.assertEqual(self.processor.includes["foo.html"],
+ in spec.excludes)
+ self.assertEqual(spec.includes["foo.html"],
"http://www.python.org/index.html")
- self.assertEqual(self.processor.includes[join("doc", "whatzit.txt")],
+ self.assertEqual(spec.includes[join("doc", "whatzit.txt")],
"repository:doc/whatzit.txt")
def test_error_on_nonexistant_ignore(self):
f = StringIO("""
does-not-exist.txt -
""")
+ spec = include.Specification(self.source)
try:
- self.processor.loadSpecification(f, "<string>")
+ spec.load(f, "<string>")
except include.InclusionSpecificationError, e:
self.assertEqual(e.filename, "<string>")
self.assertEqual(e.lineno, 2)
@@ -73,8 +75,9 @@
def test_error_on_omitted_source(self):
f = StringIO("whatzit.txt \n")
+ spec = include.Specification(self.source)
try:
- self.processor.loadSpecification(f, "<string>")
+ spec.load(f, "<string>")
except include.InclusionSpecificationError, e:
self.assertEqual(e.filename, "<string>")
self.assertEqual(e.lineno, 1)
@@ -83,17 +86,18 @@
def test_globbing_on_ignore(self):
f = StringIO("*.txt -")
- self.processor.loadSpecification(f, "<string>")
- self.assertEqual(len(self.processor.excludes), 1)
+ spec = include.Specification(self.source)
+ spec.load(f, "<string>")
+ self.assertEqual(len(spec.excludes), 1)
self.assert_(join(self.source, "ignorethis.txt")
- in self.processor.excludes)
+ in spec.excludes)
def test_normalizePath(self):
- normalize = self.processor.normalizePath
+ normalize = include.Specification("foo").normalizePath
self.check_normalize_paths(normalize)
def test_normalizePathOrURL(self):
- normalize = self.processor.normalizePathOrURL
+ normalize = include.Specification("foo").normalizePathOrURL
self.check_normalize_paths(normalize)
self.check_normalize_urls(normalize)
@@ -129,9 +133,9 @@
self.assert_(os.path.isfile(join(self.destination, "ignorethis.txt")))
def test_createDistributionTree(self):
- sio = StringIO("__init__.py -")
- self.processor.loadSpecification(sio, "<string>")
- self.processor.createDistributionTree()
+ spec = include.Specification(self.source)
+ spec.load(StringIO("__init__.py -"), "<string>")
+ self.processor.createDistributionTree(spec)
self.check_file("ignorethis.txt")
self.check_file("somescript.py")
self.assert_(not os.path.exists(join(self.destination, "__init__.py")))
More information about the Zope-CVS
mailing list