Skip to content

Commit

Permalink
fix test_webparts (I broke it..)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dustin J. Mitchell committed Feb 15, 2010
1 parent 466664a commit a5a128a
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions buildbot/test/runs/test_webparts.py
Expand Up @@ -2,6 +2,7 @@

import os
import re
import sys
import urlparse

from twisted.trial import unittest
Expand All @@ -19,6 +20,12 @@
from test_web import BaseWeb, base_config, SimpleMaster
from buildbot.buildrequest import BuildRequest

# any() is only defined in python 2.5 and up
if sys.version < (2,5):
def any(it):
for elt in it:
if elt: return True
return False

class _WebpartsTest(BaseWeb):
def find_webstatus(self, master):
Expand Down Expand Up @@ -183,7 +190,7 @@ def resolve(self, URL, id, context):
#determine cache filename
url = urlparse.urlparse(URL)
dtdPath = util.sibpath(__file__,
url.hostname + '.' + url.path.replace('/', '.'))
url[1] + '.' + url[2].replace('/', '.'))
#cache if necessary
if not os.path.exists(dtdPath):
raise ValueError("URL '%s' is not cached in '%s'" % (URL, dtdPath))
Expand Down Expand Up @@ -383,10 +390,10 @@ def _reporterrors(self, _):

# these numbers need adjustment when web layout changes
# but should catch empty pages
self.failIf(url_count < 55,
"Only %i urls visited, expected at least 55" % url_count)
self.failIf(skip_count < 15,
"Only %i urls skipped, expected at least 15" % skip_count)
self.failIf(url_count < 54,
"Only %i urls visited, expected at least 54" % url_count)
self.failIf(skip_count < 18,
"Only %i urls skipped, expected at least 18" % skip_count)
self.failIf(self.link_count < 770,
"Only %i links encountered, expected at least 770" % self.link_count)

Expand Down Expand Up @@ -485,8 +492,8 @@ def _validate_and_recurse(self, page, url):
# remove namespace (assume only xhtml namespace)
tag = element.tag.split('}')[1]

# FIXME: rebuild redirects to a bad place in this test
untestable = ['/rebuild', '/stop']
# FIXME: relative redirects are baaaad
untestable = ['/rebuild', '/stop', '/ping']
if any (map(lambda e: link.endswith(e), untestable)):
continue

Expand Down

0 comments on commit a5a128a

Please sign in to comment.