Changed the text emitted during testing to have less noice at the beginning of the line -- only 'OK', 'Fail', and the initial line of coverage reports now starts at the beginning of the line, without whitespace. This makes it easier to scan a test run visually to find reported failures.

- Legacy-Id: 2259
This commit is contained in:
Henrik Levkowetz 2010-05-12 12:13:48 +00:00
parent c0d96d16f1
commit e113f13590
10 changed files with 46 additions and 36 deletions

View file

@ -46,7 +46,7 @@ class IndexTestCase(unittest.TestCase, RealDatabaseTest):
self.tearDownRealDatabase()
def testAllId(self):
print "Testing all_id.txt generation"
print " Testing all_id.txt generation"
c = Client()
response = c.get('/drafts/_test/all_id.txt')
self.assertEquals(response.status_code, 200)
@ -69,4 +69,4 @@ class IndexTestCase(unittest.TestCase, RealDatabaseTest):
pass
else:
self.fail("Unexpected line \""+line+"\"")
print "OK (all_id.txt)"
print "OK (all_id.txt)"

View file

@ -356,14 +356,14 @@ class MirrorScriptTestCases(unittest.TestCase,RealDatabaseTest):
self.tearDownRealDatabase()
def testRfcIndex(self):
print "Testing rfc-index.xml parsing"
print " Testing rfc-index.xml parsing"
from ietf.idrfc.mirror_rfc_index import parse
data = parse(StringIO.StringIO(TEST_RFC_INDEX))
self.assertEquals(len(data), 6)
print "OK"
def testRfcEditorQueue(self):
print "Testing queue2.xml parsing"
print " Testing queue2.xml parsing"
from ietf.idrfc.mirror_rfc_editor_queue import parse_all
(drafts,refs) = parse_all(StringIO.StringIO(TEST_QUEUE))
self.assertEquals(len(drafts), 3)

View file

@ -5,11 +5,13 @@
# draft that's now RFC
200 /doc/draft-ietf-avt-rtp-atrac-family/
200 /doc/draft-ietf-avt-rtp-atrac-family/_debug.data
200 /doc/draft-ietf-avt-rtp-atrac-family/doc.json
200 /doc/draft-ietf-avt-rtp-atrac-family/ballot.json
200 /doc/draft-ietf-avt-rtp-atrac-family/_ballot.data
# replaced draft, never went to IESG
200 /doc/draft-eronen-mobike-mopo/
404 /doc/draft-eronen-mobike-mopo/ballot.json
404 /doc/draft-eronen-mobike-mopo/_ballot.data
# expired draft
@ -17,21 +19,26 @@
# Normal RFC
200 /doc/rfc4739/
200 /doc/rfc4739/_debug.data
200 /doc/rfc4739/doc.json
404 /doc/rfc4739/ballot.json
404 /doc/rfc4739/_ballot.data
# RFC that's evaluated in IESG
200 /doc/rfc3852/
200 /doc/rfc3852/_debug.data
200 /doc/rfc3852/doc.json
200 /doc/rfc3852/ballot.json
200 /doc/rfc3852/_ballot.data
# old RFC
200 /doc/rfc822/
200 /doc/rfc822/_debug.data
200 /doc/rfc822/doc.json
# ballot sets
200 /doc/rfc3550/ballot.json
200 /doc/rfc3550/_ballot.data
200 /doc/rfc3551/ballot.json
200 /doc/rfc3551/_ballot.data
200 /doc/draft-irtf-dtnrg-ltp/ballot.json
200 /doc/draft-irtf-dtnrg-ltp/_ballot.data
# file formats
@ -42,7 +49,7 @@
404 /doc/draft-no-such-draft/
404 /doc/rfc4637/
200 /doc/rfc2444/_debug.data # foreignkey problem with Django 1.x
200 /doc/rfc2444/doc.json # foreignkey problem with Django 1.x
# current AD -- needs to be updated at some point
200 /doc/ad/robert.sparks/
@ -51,8 +58,10 @@
404 /doc/ad/no.body/
# ballot exists, but it's not issued
404 /doc/draft-ietf-aaa-diameter-api/ballot.json
404 /doc/draft-ietf-aaa-diameter-api/_ballot.data
# ballot does not exist
404 /doc/draft-zeilenga-cldap/ballot.json
404 /doc/draft-zeilenga-cldap/_ballot.data
# comment with created_by=999
200 /doc/draft-ietf-l3vpn-2547bis-mcast-bgp/

View file

@ -8,11 +8,11 @@ import django.test
class TemplateTagTest(unittest.TestCase):
def testTemplateTags(self):
print "Testing ietf_filters"
print " Testing ietf_filters"
#doctest.testmod(ietf_filters,verbose=True)
(failures, tests) = doctest.testmod(ietf_filters)
self.assertEqual(failures, 0)
print "OK (ietf_filters)"
print "OK (ietf_filters)"
class IdTrackerUrlTestCase(SimpleUrlTestCase):
def testUrls(self):
@ -34,7 +34,7 @@ class WGRoleTest(django.test.TestCase):
self.snow = IETFWG.objects.get(group_acronym__acronym='snow')
def test_roles(self):
print "Testing WG roles"
print " Testing WG roles"
self.assertEquals(self.xmas.wgchair_set.all()[0].role(), 'xmas WG Chair')
self.assertEquals(self.snow.wgchair_set.all()[0].role(), 'snow BOF Chair')
self.assertEquals(self.xmas.wgsecretary_set.all()[0].role(), 'xmas WG Secretary')

View file

@ -66,7 +66,7 @@ class IetfAuthTestCase(unittest.TestCase,RealDatabaseTest):
def testLogin(self):
TEST_USERNAME = '__testuser'
print "Testing login with "+TEST_USERNAME
print " Testing login with "+TEST_USERNAME
# Delete test user (if it exists)
try:
@ -83,9 +83,9 @@ class IetfAuthTestCase(unittest.TestCase,RealDatabaseTest):
print "OK"
def testGroups(self):
print "Testing group assignment"
print " Testing group assignment"
username = Role.objects.get(id=Role.IETF_CHAIR).person.iesglogin_set.all()[0].login_name
print "(with username "+str(username)+")"
print " (with username "+str(username)+")"
self._doLogin(username)

View file

@ -73,19 +73,19 @@ class NewIprTestCase(unittest.TestCase,RealDatabaseTest):
self.tearDownRealDatabase()
def testNewSpecific(self):
print "Testing IPR disclosure submission"
print " Testing IPR disclosure submission"
test_runner.mail_outbox = []
c = Client()
response = c.post('/ipr/new-specific/', self.SPECIFIC_DISCLOSURE)
self.assertEquals(response.status_code, 200)
self.assert_("Your IPR disclosure has been submitted" in response.content)
self.assertEquals(len(test_runner.mail_outbox), 1)
print "OK (1 email found in test outbox)"
print "OK (1 email found in test outbox)"
class IprFileTestCase(unittest.TestCase):
def testFileExistence(self):
print "Testing if IPR disclosure files exist locally"
print " Testing if IPR disclosure files exist locally"
fpath = os.path.join(settings.IPR_DOCUMENT_PATH, "juniper-ipr-RFC-4875.txt")
if not os.path.exists(fpath):
print "\nERROR: IPR disclosure files not found in "+settings.IPR_DOCUMENT_PATH
@ -94,5 +94,5 @@ class IprFileTestCase(unittest.TestCase):
print "wget -nd -nc -np -r ftp://ftp.ietf.org/ietf/IPR/"
print "And set IPR_DOCUMENT_PATH in settings_local.py\n"
else:
print "OK (they seem to exist)"
print "OK (they seem to exist)"

View file

@ -93,7 +93,7 @@ class RedirectsTestCase(unittest.TestCase, RealDatabaseTest):
self.tearDownRealDatabase()
def testRedirects(self):
print "Testing redirects"
print " Testing redirects"
c = Client()
for src, dst in REDIRECT_TESTS.items():
@ -132,7 +132,7 @@ def get_patterns(module):
class UrlCoverageTestCase(unittest.TestCase):
def testUrlCoverage(self):
print "Testing testurl.list coverage"
print " Testing testurl.list coverage"
testtuples = []
for root, dirs, files in os.walk(settings.BASE_DIR):
if "testurl.list" in files:
@ -150,7 +150,7 @@ class UrlCoverageTestCase(unittest.TestCase):
print "The following URLs are not tested by any testurl.list"
for pattern in missing:
if not pattern[1:].split("/")[0] in [ "admin", "accounts" ]:
print "NoTest", pattern
print " NoTest", pattern
print ""
else:
print "All URLs are included in some testurl.list"
@ -177,10 +177,10 @@ def get_templates():
class TemplateCoverageTestCase(unittest.TestCase):
def testTemplateCoverage(self):
if not test_runner.loaded_templates:
print "Skipping template coverage test"
print " Skipping template coverage test"
return
print "Testing template coverage"
print " Testing template coverage"
all_templates = get_templates()
#notexist = list(test_runner.loaded_templates - all_templates)
@ -195,7 +195,7 @@ class TemplateCoverageTestCase(unittest.TestCase):
notloaded.sort()
print "The following templates were never loaded during test"
for x in notloaded:
print "NotLoaded", x
print " NotLoaded", x
else:
print "All templates were loaded during test"
print " All templates were loaded during test"

View file

@ -44,17 +44,17 @@ old_create = None
def safe_create_1(self, verbosity, *args, **kwargs):
global test_database_name, old_create
print "Creating test database..."
print " Creating test database..."
x = old_create(self, 0, *args, **kwargs)
print "Saving test database name "+settings.DATABASE_NAME+"..."
print " Saving test database name "+settings.DATABASE_NAME+"..."
test_database_name = settings.DATABASE_NAME
return x
def safe_destroy_0_1(*args, **kwargs):
global test_database_name, old_destroy
print "Checking that it's safe to destroy test database..."
print " Checking that it's safe to destroy test database..."
if settings.DATABASE_NAME != test_database_name:
print "NOT SAFE; Changing settings.DATABASE_NAME from "+settings.DATABASE_NAME+" to "+test_database_name
print " NOT SAFE; Changing settings.DATABASE_NAME from "+settings.DATABASE_NAME+" to "+test_database_name
settings.DATABASE_NAME = test_database_name
return old_destroy(*args, **kwargs)
@ -79,6 +79,7 @@ def run_tests_1(test_labels, *args, **kwargs):
if not test_labels:
settings.TEMPLATE_LOADERS = ('ietf.utils.test_runner.template_coverage_loader',) + settings.TEMPLATE_LOADERS
test_labels = [x.split(".")[-1] for x in settings.INSTALLED_APPS if x.startswith("ietf")] + ['redirects.TemplateCoverageTestCase',]
kwargs["verbosity"] = 0
run_tests(test_labels, *args, **kwargs)
def run_tests(*args, **kwargs):

View file

@ -51,12 +51,12 @@ class RealDatabaseTest:
def setUpRealDatabase(self):
self._original_testdb = self._getDatabaseName()
newdb = ietf.settings.DATABASE_NAME
print "Switching database from "+self._original_testdb+" to "+newdb
print " Switching database from "+self._original_testdb+" to "+newdb
self._setDatabaseName(newdb)
def tearDownRealDatabase(self):
curdb = self._getDatabaseName()
print "Switching database from "+curdb+" to "+self._original_testdb
print " Switching database from "+curdb+" to "+self._original_testdb
self._setDatabaseName(self._original_testdb)
def _getDatabaseName(self):
@ -118,7 +118,7 @@ class SimpleUrlTestCase(TestCase,RealDatabaseTest):
def doTestUrls(self, test_filename):
filename = os.path.dirname(os.path.abspath(test_filename))+"/testurl.list"
print "Reading "+filename
print " Reading "+filename
tuples = read_testurls(filename)
failures = 0
for tuple in tuples:
@ -136,7 +136,7 @@ class SimpleUrlTestCase(TestCase,RealDatabaseTest):
#settings.DEBUG = True
try:
if "heavy" in codes and self.skip_heavy_tests:
print "Skipping heavy test %s" % (url,)
print " Skipping heavy test %s" % (url,)
return
now = datetime.utcnow()
response = self.client.get(baseurl, args)

View file

@ -41,7 +41,7 @@ class WgInfoUrlTestCase(SimpleUrlTestCase):
class WgFileTestCase(unittest.TestCase):
def testFileExistence(self):
print "Testing if WG charter files exist locally"
print " Testing if WG charter files exist locally"
fpath = os.path.join(settings.IETFWG_DESCRIPTIONS_PATH, "tls.desc.txt")
if not os.path.exists(fpath):
print "\nERROR: charter files not found in "+settings.IETFWG_DESCRIPTIONS_PATH
@ -50,5 +50,5 @@ class WgFileTestCase(unittest.TestCase):
print "wget -nd -nc -np -r http://www.ietf.org/wg-descriptions/"
print "And set IETFWG_DESCRIPTIONS_PATH in settings_local.py\n"
else:
print "OK (they seem to exist)"
print "OK (they seem to exist)"